B
Bo Lindbergh
Consider this snippet:
{
sub foo {
print scalar(@_)," arguments\n";
}
foo((17)[2,1]);
foo(my @foo=(17)[2,1]);
}
When run by my perl 5.8.8, it produces these two lines of output:
2 arguments
0 arguments
So there seems to be (at least) two kinds of list context,
one used for evaluating function arguments and another one used
for evaluating the rhs of an assignment. I can't find any mention
of this in perldata.pod. What's up?
/Bo Lindbergh
{
sub foo {
print scalar(@_)," arguments\n";
}
foo((17)[2,1]);
foo(my @foo=(17)[2,1]);
}
When run by my perl 5.8.8, it produces these two lines of output:
2 arguments
0 arguments
So there seems to be (at least) two kinds of list context,
one used for evaluating function arguments and another one used
for evaluating the rhs of an assignment. I can't find any mention
of this in perldata.pod. What's up?
/Bo Lindbergh