my %data_hash = map { /(\w\s+\d)/ => $_ } @data2; for my $key ( %data_hash ) { print "$data_hash{$key}\n" if grep { /^$key/ } @data1; }
I also wondered about anchoring that match. In earlier versions, I did anchor it. But, I wasn't sure if it was necessary given the data set. I think I'll add it back as it's probably safer.
Thanks for the advice!
In reply to Re^3: Help understand why this grep does not work
by drmrgd
in thread Help understand why this grep does not work
by drmrgd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |