Re: Read 20 lines when pressing n for next



s9uzaa@xxxxxxxxx wrote:
I would like to write a perl script with the following criteria match.
1. open any text file

perldoc -f open

taken the name from the command line.

perldoc perlvar and check for '@ARGV'

2. read top 20 lines and stops, then

perldoc perlsyn and check for 'for'. However given the next requirement
the algorithm becomes a lot easier if you slurp in the whole file into
an array. If you read 20 line chunks then you need to seek forward and
backward all the time which is a real pain. In an array you just move
your current index.

3. ask to press letter "n or p" (for next/previous)

perldoc -q single

to print next or previous 20 lines.
would appreciate any kind of help.

Maybe you should ask your tutor/teacher?

4. must have subroutine used.

perldoc perlsub

jue
.



Relevant Pages

  • Re: style of functions with complex arguments
    ... > where the list at the end is actually a set of 3 triples. ... triples I would use an array reference as well. ... then you need to check that the 'weights' is an array ref (perldoc -f ...
    (perl.beginners)
  • RE: Why doesnt this work?
    ... Any time you don't understand a Perl function, look it up via perldoc. ... the shiftin the sub: ... Removes the first element of an array and stores it in $search. ...
    (perl.beginners)
  • RE: How to store the out put in StringBuffer
    ... I have been mentioning @tail. ... An array is the one variable that can do what you ... perldoc perlintro ... How to store the out put in StringBuffer ...
    (perl.beginners)
  • Re: problem with eval
    ... What is in the @_ array? ... only subroutine arguments go to ... evaluates that string as *Perl* code. ... perldoc -f system ...
    (perl.beginners)
  • Re: Easy Field Grabbing Question
    ... > ok another stupid question time! ... > how does the above work for an array?? ... While, with perldoc, it can sometimes be a little hard to figure out how ... and learn some of the basics first. ...
    (comp.lang.perl.misc)