if ($line =~ /^Parsing \[(sent. \d+) len. \d+\]: \[(.+)\] +/) { push( @{$one_match_ref}, $1); my $nocomma_sent = $2; $nocomma_sent =~ s/,//g; push( @{$one_match_ref}, $nocomma_sent); }