Skip to content

Commit

Permalink
check the return value of the open
Browse files Browse the repository at this point in the history
  • Loading branch information
petdance committed Jun 12, 2012
1 parent 191a72c commit f0ea864
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions t/first-and-last-lines-via-process-pipe.pl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@


my $files = File::Next::files( $input ); my $files = File::Next::files( $input );
my $file = $files->(); my $file = $files->();
open my $f, '<', $file if defined $file; if ( open my $f, '<', $file ) {
if ( $f ) {
my @lines = <$f>; my @lines = <$f>;
print $lines[0]; print $lines[0];
print $lines[-1]; print $lines[-1];
Expand Down

0 comments on commit f0ea864

Please sign in to comment.