Update: Added example code with "#bad" mark$ perl -MIO::Handle -le 'open my $fh, "<", shift or die $!; print $fh- +>input_line_number while <$fh>' a_file_name 1 2 3 4 . . . $ perl -MIO::Handle -le 'open my $fh, "<", shift or die $!; print (\$f +h)->input_line_number while <$fh>' a_filename REF(0x99d7cdc) Can't call method "input_line_number" without a package or object refe +rence at -e line 1, <$fh> line 1. # $fh = do {local *FH}; #bad $ perl -MIO::Handle -le 'my $fh = do {local *FH}; open $fh, "<", shift + or die $!; print (\$fh)->input_line_number while <$fh>' a_file_name GLOB(0x846ccdc) Can't call method "input_line_number" without a package or object refe +rence at -e line 1, <FH> line 1.
Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!
In reply to Re^2: Last Line Read? (Any way to use IO::Handle methods on a "First-Class" Filehandle?)
by naikonta
in thread Last Line Read? (Any way to use IO::Handle methods on a "First-Class" Filehandle?)
by blahblahblah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |