sub first_match ($@) { my ($regex, @data) = @_; my $result; for (@data) { $result = $1 and last if /$regex/ } return $result; }