Be aware that calling exists on array values is deprecated and likely to be removed in a future version of Perl. #### my $retn = first {m/aa/} @a;