On Thu, Jul 26, 2001 at 11:24:12PM +0400, Maxim Berlin wrote:
> Thursday, July 26, 2001, Maxim Berlin <[EMAIL PROTECTED]> wrote:
>
> MB> $boolean = grep /AF00001/,@mylist;
> sorry, incorrect sample. should be:
> $boolean = grep /^AF00001$/,@mylist;
> with first regexp you catch every string, that contain 'AF00001'.
Better yet, $boolean = grep { $_ eq 'AF00001' } @mylist;
Even better still, don't use grep; it doesn't stop iterating over the list
once it finds a match, so the entire list is always searched. A better
solution would be to use foreach or a hash, as suggested by others.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]