http://www.perlmonks.org?node_id=1014749


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

Actually, I think I've just worked it out my head. Took a bit of thinking but this is what i think it is doing
first line gets sent, but because <> is unassigned (before $s), it skips; then reads the second line and assigns $s to the line and does whatever; then reads third line but because <> is unassigned, it skips; reads fourth line and the same happens; restarts with 5 line but again because <> is unassigned before the $s it skips; reads 6th line and assigns it to $s and does whatever again
this continues until end of file

If this is incorrect, let me know. Otherwise I hope this helps anyone else who might look at it. Thanks for your help choroba