That works on exact matches however the string I'm trying to match on is
part of a path "/home/production/servername/configfile.cfg". I'm trying to
match on the servername part, and it is not always the same path.
-----Original Message-----
From: owner-nolug@joeykelly.net [mailto:owner-nolug@joeykelly.net] On Behalf
Of Mark A. Hershberger
Sent: Thursday, October 14, 2004 5:21 AM
To: nolug@joeykelly.net
Subject: Re: [Nolug] PERL Question
Wimprine, Thomas wrote:
> Let me clarify something if the $list[$num] does not contain $ARGV[$num]
> then delete;
--- start file.pl ---
#!/usr/bin/perl -w
my @list = qw(one two three);
my %list;
$list{$_} = 1
for @list;
@list = grep {$list{$_}} @ARGV;
print join(", ", @list), "\n";
--- end file.pl ---
Sample runs:
$ perl file.pl one
one
$ perl file.pl one two four
one two
$ perl file.pl
$
Is that what you wanted?
Mark
___________________
Nolug mailing list
nolug@nolug.org
___________________
Nolug mailing list
nolug@nolug.org
Received on 10/14/04
This archive was generated by hypermail 2.2.0 : 12/19/08 EST