in reply to Re^2: Perl not able to read file
in thread Perl not able to read file
Yes, but there's no open going on the same filehandle, there is another filehandle opened for the same file .
Try commenting the indicated line:
#!/usr/bin/perl use warnings; use strict; open my $OUT, '>', '1' or die $!; open my $IN, '<', '1' or die $!; print {$OUT} "$_\n" for 1 .. 20; close $OUT or die $!; # <- Comment me! print while <$IN>;
It's true that I'd rather open the filehandle later before reading from it, not at the top of the script, but even in such situation you need to close the output filehandle before reading from the file.
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Perl not able to read file
by Laurent_R (Canon) on Sep 22, 2017 at 10:04 UTC |