Hi Janek,
In article <[EMAIL PROTECTED]>, Janek Schleicher
wrote:
> Sitha Nhok wrote at Thu, 26 Jun 2003 12:47:25 -0400:
>
>> Is there anyway to match a string in a 2-dimensional array only at one
>> index? For example, say I have this 2-d array:
>>
>> @AoA = (
>> ["ABC", "BCD"],
>> ["CDE", "DEF"],
>> ["EFG", "FGH"],
>> );
>>
>> Then I wanted to see if "CD" exist, but only in column index 1
>> ($AoA[$row][1]). Is there a way to do this w/o using a "for" loop
>> within a "for" loop? Thanks.
>
> [untested]
> if (grep /CD/, map {$_->[1]} @AoA) {
> ...
> }
It seems (to me) like it should work, but... (here's my most recent test
variation):
if (grep 'CD', my @tmp = map {$_->[1]} @AoA) {
print "@tmp\n";
print "Found CD here: $_\n";
}
@tmp is fine, but that's about all. (?)
--
Kevin Pfeiffer
International University Bremen
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]