Assigning anonymous hash to a list

Paul Makepeace paulm at paulm.com
Wed Jul 31 19:02:32 BST 2013


On Wed, Jul 31, 2013 at 10:37 AM, Peter Corlett <abuse at cabal.org.uk> wrote:

> On Wed, Jul 31, 2013 at 01:04:11PM -0300, Hernan Lopes top-posted:
> > it should be the same size to do what he wants... otherwise it wont work.
>
> Why "should"? Perl doesn't require the LHS of an array assignment have the
> same
> number of elements as the RHS, and there are a number of use cases where
> you
> may not want it.
>

Indeed. E.g.,

my ($arg1, $arg2, $..., @...) = @_;  # is covered early on in a perl
neophyte's training

Paul


More information about the london.pm mailing list