Hello jayu_rao,
The method File::ReadBackwards->new() takes a filename (i.e., a string) as its first (and only required) argument. But if you first say:
open my $read_log_file, '<', '/home/jay/my_perl_programs/log.txt' or d +ie $!;
you create $read_log_file as a file handle, which is something quite different. (It’s like a special kind of pointer that Perl uses to access a file.) You can see this if you try to print it as a string:
16:13 >perl -Mstrict -wE "open(my $fh, '<', '1184_SoPW.pl') or die; sa +y qq[>$fh<];" >GLOB(0x7ec4f8)< 16:14 >
If you then call File::ReadBackwards->new($fh) it will try to access a file named “GLOB(0x7ec4f8)” — and fail, because there is no file of that name.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: ReadBackwards usage
by Athanasius
in thread Readbackwards usage
by jayu_rao
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |