my $x = dopen( '/dev/null', 'file-not-found', '/etc/passwd' ); sub dopen { my $out = []; FILE: foreach my $file ( @_ ) { my $fh; if ( ! open $fh, '<', $file ) { warn "Can't read '$file': $!\n"; next FILE; } push @{$out}, <$fh>; } return $out; } __END__ Can't read 'file-not-found': No such file or directory