yesitsjess has asked for the wisdom of the Perl Monks concerning the following question:
Hi all, is it possible to add two regex matches to the same element of an array?
In example below (doesn't work), both the 11 and 6 digit numbers appear multiple times, but later on I convert to a hash to get each unique mention and I want to preserve the relationship between the 6 digit number and 11 digit number.
foreach my $line (@data){ push (@array , (join($line =~ m/(\d{11})/g , $line =~ m/(\d{6})/g))); }
Update
Nevermind, solved by work colleague. Needed something to join them with (used tab in solved example)
foreach my $line (@data){ push (@array , (join("\t" , $line =~ m/(\d{11})/g , $line =~ m/(\d{6}) +/g))); }
|
|---|