in reply to Re: Last Line Read? (Any way to use IO::Handle methods on a "First-Class" Filehandle?)
in thread Last Line Read? (Any way to use IO::Handle methods on a "First-Class" Filehandle?)
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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Last Line Read? (Any way to use IO::Handle methods on a "First-Class" Filehandle?)
by ysth (Canon) on Jun 08, 2007 at 08:22 UTC | |
by naikonta (Curate) on Jun 08, 2007 at 08:42 UTC | |
by ysth (Canon) on Jun 08, 2007 at 09:11 UTC |