walto has asked for the wisdom of the Perl Monks concerning the following question:
use warnings; use strict; open my $FH,">>","test.txt" or die ">>: $!"; my @file = <$FH>; if (defined $file[0]){ print "Open with >>: ",shift @file,"\n"; } else { print "Open with >>: undef\n"; } close $FH; open my $IN,"+<","test.txt" or die "#<: $!n"; my @file_new = <$IN>; if (defined $file_new[0]){ print "Open with +<: ",shift @file_new,"\n"; } else { print "Open with +<: undef\n"; } close $IN;
Open with >>: undef Open with +<: Test
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Problems with open $FH
by jwkrahn (Abbot) on Apr 25, 2008 at 05:11 UTC |