sub get_captures { my ($pattern, $line) = @_; my @captures = $line =~ m/$pattern/; return @captures[0 .. $#+ - 1]; }