The core module List::Util will be more efficient if there is a match since it will stop as soon as one is found.
use List::Util qw(first); my $SearchStr = "test2.txt"; my $SearchResult = first { $_->[0] eq $SearchStr } @cdata; print "Found file: $SearchResult->[0]\n";
In reply to Re: find a string in an array of arrays
by hipowls
in thread find a string in an array of arrays
by jgatrell42
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |