Have a look at the last code in the OP (I updated it 10 minutes after posting)
given(@array) and given(\@array) both produce the same ref in $_, but the smartmatch doesn't work as documented.
While I can understand why to limit given to simple scalars I think the docs should either be updated to reflect this behaviour or it's a bug.
UPDATE: you should add continues to se which clauses are true
my @a=('abc',1);
given (@a) {
when (/abc/ ) { print "abc\n" ;continue}
when (1 ) { print "#\n" ;continue}
when (['abc',1]) { print "copy\n" ;continue}
when (\@a ) { print "self\n" }
}
OUTPUT
Argument "abc" isn't numeric in smart match at /home/lanx/tmp/ike_give
+n.pl line 9.
#
copy
self
|