Uh, not exactly. It actually evaluates in list context but treats the return as if it were in scalar. Like so:
#!/usr/bin/perl -wl my @x = qw[ a b c d ]; sub x { print wantarray ? "list context" : defined(wantarray) ? "scalar context" : "void context"; @x } print "@{[ x() ]} - ${\ ( x() )} - ${\ ( @x )}"; __END__ list context list context a b c d - d - d
In reply to Re^4: Printing accessor methods in here documents
by !1
in thread Printing accessor methods in here documents
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |