Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Paging on input/file

by tachyon (Chancellor)
on Aug 04, 2004 at 13:14 UTC ( [id://379983]=note: print w/replies, xml ) Need Help??


in reply to Paging on input/file

If you want to roll your own it is easily achieved using % and <>. Piping to more/less is more or less traditional ;-) I recommend you use one of the modules if you want robust and portable, although a straight pipe to more will work on *nix and Win32.

my $lines = 2; while(<DATA>) { chomp; print; $. % $lines == 0 ? <> : print "\n"; } __DATA__ foo bar baz boo

cheers

tachyon

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://379983]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-24 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found