RE: grep, and push to array if item not found

2004-10-20 Thread Steve Bertrand
> Steve Bertrand wrote: >> > Steve Bertrand wrote: >> > > I got it... >> > > >> > > for my $item (@clean) { >> > > if (! grep ($_ eq $item, @array)) { >> > > push (@array, $item); >> > > print "$item\n"; >> > > } >> > > } >> > >> > FWIW, this is a FAQ

RE: grep, and push to array if item not found

2004-10-20 Thread Bob Showalter
Steve Bertrand wrote: > > Steve Bertrand wrote: > > > I got it... > > > > > > for my $item (@clean) { > > > if (! grep ($_ eq $item, @array)) { > > > push (@array, $item); > > > print "$item\n"; > > > } > > > } > > > > FWIW, this is a FAQ (see "perl

RE: grep, and push to array if item not found

2004-10-20 Thread Steve Bertrand
> Steve Bertrand wrote: >> I got it... >> >> for my $item (@clean) { >> if (! grep ($_ eq $item, @array)) { >> push (@array, $item); >> print "$item\n"; >> } >> } > > FWIW, this is a FAQ (see "perldoc -q duplicate"). If the array > elements can > be c

RE: grep, and push to array if item not found

2004-10-20 Thread Bob Showalter
Steve Bertrand wrote: > I got it... > > for my $item (@clean) { > if (! grep ($_ eq $item, @array)) { > push (@array, $item); > print "$item\n"; > } > } FWIW, this is a FAQ (see "perldoc -q duplicate"). If the array elements can be compared with str

Re: grep, and push to array if item not found

2004-10-20 Thread Steve Bertrand
> Hi all, > > I am practicing using grep, but have a problem. Instead of directly > building an array in a traditional format with grep: > > @array = (grep $_, @input); > > I want to push items into a new array that DO NOT appear within the > current array being grepped for. Hence: > > use strict;

grep, and push to array if item not found

2004-10-20 Thread Steve Bertrand
Hi all, I am practicing using grep, but have a problem. Instead of directly building an array in a traditional format with grep: @array = (grep $_, @input); I want to push items into a new array that DO NOT appear within the current array being grepped for. Hence: use strict; my @array = (); m