http://www.perlmonks.org?node_id=968435


in reply to Re^2: perl array of hashes help
in thread perl array of hashes help

Hi Sridhar! Please take a look at the smart match operator. As you can see, 'item' ~~ \@array returns true if the 'item' exists inside the array passed as an array reference.

Your code doesn't work because $_->{bill} is a reference to an array, so what you are actually trying is something like this: 'ARRAY(0x886b7f8)' =~ /1117/; (i.e.: return true if the left side contains the substring from the right side).

Of course, if you're trying to match a substring inside an array, you can use: grep { qr/1117/ ~~ $_->{bill} } @array;