in reply to deleting a non-numeric scalar within array
$line contains a line of text from the file, you can't use that as an index into the array. You need to do something like this:
foreach my $index ( 0 .. $#hosts ) { if ( $hosts[ $index ] =~ /$ARGV[0]/ ) { print $hosts[ $index ]; delete $hosts[ $index ]; } }
|
|---|