Re: [Nolug] PERL Question

From: Mark A. Hershberger <mah_at_everybody.org>
Date: Thu, 14 Oct 2004 06:21:19 -0400
Message-ID: <416E531F.2080206@everybody.org>

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
Received on 10/14/04

This archive was generated by hypermail 2.2.0 : 12/19/08 EST