Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^4: command line perl reading from STDIN

by Anonymous Monk
on Jan 23, 2013 at 23:32 UTC ( #1015044=note: print w/replies, xml ) Need Help??

in reply to Re^3: command line perl reading from STDIN
in thread command line perl reading from STDIN

 perl -ne ' $s=<>; <>; <>; do_something_with_$s'

is equivalent to

 perl  -e ' while (<>) { $s=<>; <>; <>; do_something_with_$s} '

so 4 lines will be read each pass, but only the second line will be used for anything

Personally, I'd go with something like

 perl -ne 'chomp; print length($_)."\n" if (/^@/);'


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1015044]
choroba hates the CB and its space insertion
Eily wondered if the space was there for a reason
[Eily]: like "Replace the T, replace the y, skip one, replace the o"
[Discipulus]: it works anyway, good morning choroba
[Discipulus]: choroba i'm considering to add some connection checking to your CB tk program: something like..

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2017-07-24 09:20 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (348 votes). Check out past polls.