I'd actually be surprised if that works...
let me point out a few things:
if ($list = 'foo') will always be true.. you are assigning 'foo' to $list
what you want is probably 'eq'
the if block also needs curly brackets {} around it, especially if you want
to use the 'else' part
more so, assumign the rest of the code works, setting $boolean to '0' on a
failed match will mean this entire match woudl produce $boolean == 0 except
when the last element of the array matches.
what i think you want is this:
my $flag;
for(@list) { if ( $_ eq 'AF00001' ) { $flag = 1; last; } }
we simply iterate over the list, if $_ matches what we want, we set the flag
and exit the loop
hth,
Jos Boumans
<snip>
I want to test if "AF00001" is in my list @mylist;
I did:
foreach $LIST (@mylist) {
if ($LIST = "AF00001")
$boolean = 1;
else
$boolean = 0;
}
is there a more elegant way to do it?
many thanks
jennifer
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]