Alex Francis wrote:
> $ perl -e 'use strict; use warnings; sub foo { return ( 6, 7 ) } my
> $got = foo(); print $got . "\n"'
> 7
>
> $ perl -e 'use strict; use warnings; sub foo { my @ret = ( 6, 7 );
> return @ret } my $got = foo(); print $got . "\n"'
> 2
>
Surely there is a way of forcing list context without creating an array?
> Had me puzzled for a minute or two, til I realised the scalar context
> changed the behaviour of the comma - proper explanation from perldoc
> perlop:
>
> Binary "," is the comma operator. In scalar context it evaluates
> its left argument, throws that value away, then evaluates its right
> argument and returns that value.
>
This is very useful to know... something tells me I should check my old
code for this...
Lyle
_______________________________________________
BristolBathPM mailing list
[email protected]
http://mailman.bristolbath.org/mailman/listinfo/bristolbathpm