for (@files) { #
open my $fh, '<', $_ or
(warn "$_: $!\n"), next;
push @first_lines, scalar <$fh>;
}
####
#!/usr/bin/perl
use strict;
use warnings;
die "Usage: $0 \n" unless @ARGV == 1;
# Rudimentary check on the argument
(my $net=shift) =~ s/\.0+$/./
or die "Supply an IP of the form <#.#.#.0>\n";
print 'Begun pings at ' . localtime, "\n";
my @p;
open $p[@p], '-|', "ping -w 5 -c 5 $net$_"
or die "Couldn't start ping for $net$_: $!\n" for 1..255;
undef $/;
print map <$_>, @p;
__END__
####
my @p = map {
open my $fh, '-|', "ping -w 5 -c 5 $net$_"
or die "Couldn't start ping for $net$_: $!\n";
$fh } 1..255;