</code>#!/usr/bin/perl -w open HOSTS, "/etc/hosts" or die "Cannot open hosts file! \n"; @hosts = <HOSTS>; foreach $line(@hosts) { if ($line =~ /($ARGV[0])/) { print $line; delete $hosts[$line]; } }
In reply to deleting a non-numeric scalar within array by pipeops
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |