in reply to Re: How to read pcap data from stream not from files.
in thread How to read pcap data from stream not from files.

while ( defined( my $line = <STDIN> ) ) {

Just a quick side note:  you don't need the defined here. Perl has some DWIMmery in place for this case, to always act as if the defined was there, even if you don't write it:

$ perl -MO=Deparse -e 'while ( my $line = <STDIN> ) { print $line }' while (defined(my $line = <STDIN>)) { do { print $line }; } -e syntax OK

Replies are listed 'Best First'.
Re^3: How to read pcap data from stream not from files.
by afoken (Chancellor) on May 09, 2010 at 05:34 UTC

    Cool. I always thought that the DWIM magic was only there for the exact expression while (<FILEHANDLE>), but not for any other construction like the assignment.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)