in reply to find a string in an array of arrays
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";
|
|---|