Reproducing a bit of your code:
my @answers;
while (my $line = <DATA>){
for my $re (@res){
my @results;
if (@results = $line =~ /$re/){
push @answers, ["@results"];
Why the quotes around @results? They weren't in the version that produced
the output you're showing.
}
}
}
You're also making an unnecessary copy of the array @results. Its scope is the loop body, so you have a new one each time through. Just take the reference:
# ...
for my $re (@res){
my @results;
push @answers, \ @results if @results = $line =~ $re;
}
# ...
Anno