Sounds like a job for grep. Here's a snippet that might help:
@LIST= ('1','2','3','4','5');
$num=$ARGV[0];
print "num is $num\n";
if (grep(/^$num$/,@LIST)) {
print "found num in list\n";
} else {
print "NOT found\n";
}
ray
On Thu, 14 Oct 2004, Wimprine, Thomas wrote:
> Let me clarify something if the $list[$num] does not contain $ARGV[$num]
> then delete;
>
> -----Original Message-----
> From: owner-nolug@joeykelly.net [mailto:owner-nolug@joeykelly.net] On Behalf
> Of Wimprine, Thomas
> Sent: Thursday, October 14, 2004 8:29 AM
> To: 'Nolug'
> Subject: [Nolug] PERL Question
>
> I have a script I'm working on and am stuck simply because I don't know Perl
> and need a little assistance.
>
> I have a script I execute from the command line with arguments (server
> names), I need to know how to match those arguments (@ARGV) with an array
> (@list) and throw away all values that do not match.
>
> Logdisk.pl server1 server2
>
> If $ARGV[$num] != $list[$num]
> Discard;
> Else
> Next;
>
> Thanks
> ___________________
> Nolug mailing list
> nolug@nolug.org
> ___________________
> Nolug mailing list
> nolug@nolug.org
>
-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Ray DeJean http://www.r-a-y.org Systems Engineer Southeastern Louisiana University IBM Certified Specialist AIX Administration, AIX Support =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ___________________ Nolug mailing list nolug@nolug.orgReceived on 10/14/04
This archive was generated by hypermail 2.2.0 : 12/19/08 EST