in reply to Re^3: Scalar Vs. List context
in thread Scalar Vs. List context
our @x; sub foo { print "wantarray? ", wantarray?1:0, "\n"; push @x, (1,2,3); return @x; } pop foo();
generates
Type of arg 1 to pop must be array (not subroutine entry) at Monks/Sni +ppet.pm line 7, near ");" Execution of Monks/Snippet.pm aborted due to compilation errors.
The same compilation error results if one tries to use a subroutine to generate the first parameter of push as well. Replacing pop foo() with push foo(), 4 results in
Type of arg 1 to push must be array (not subroutine entry) at Monks/Sn +ippet.pm line 7, near "4;" Execution of Monks/Snippet.pm aborted due to compilation errors.
Best, beth
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Scalar Vs. List context
by ikegami (Patriarch) on Jul 12, 2009 at 12:05 UTC |