pipeops has asked for the wisdom of the Perl Monks concerning the following question:
</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]; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: deleting a non-numeric scalar within array
by GrandFather (Saint) on Dec 02, 2010 at 19:57 UTC | |
|
Re: deleting a non-numeric scalar within array
by jwkrahn (Abbot) on Dec 02, 2010 at 19:21 UTC | |
|
Re: deleting a non-numeric scalar within array
by VinsWorldcom (Prior) on Dec 02, 2010 at 19:22 UTC | |
|
Re: deleting a non-numeric scalar within array
by locked_user sundialsvc4 (Abbot) on Dec 02, 2010 at 19:41 UTC | |
|
Re: deleting a non-numeric scalar within array
by Generoso (Prior) on Dec 02, 2010 at 21:16 UTC | |
|
Re: deleting a non-numeric scalar within array
by jffry (Hermit) on Dec 02, 2010 at 21:51 UTC | |
|
Re: deleting a non-numeric scalar within array
by poolpi (Hermit) on Dec 03, 2010 at 12:28 UTC |