Tuesday, September 25, 2012

Perl smart match operator

Many times, it is very handy to use this operator for comparing arrays, hashes:
use 5.010;

my(@arr_a)=qw (123 abc def ghi);
my(@arr_b)=qw (123 abc def ghi);

print "same2same\n" if (@arr_a ~~ @arr_b);

1 comment: