develooper Front page | perl.perl5.porters | Postings from November 2000

Repeating undef in list assignment

Thread Next
From:
Peter Scott
Date:
November 13, 2000 17:48
Subject:
Repeating undef in list assignment
Message ID:
4.3.2.7.2.20001113174236.00b00db0@psdt.com
Why shouldn't this be allowed:

$ perl -wle 'sub foo{(4,5,6)};((undef)x2, $x) = foo; print $x'
Can't modify repeat (x) in list assignment at -e line 1, near "foo;"
Execution of -e aborted due to compilation errors.

What makes it different from this:

$ perl -wle 'sub foo{(4,5,6)};(undef,undef, $x) = foo; print $x'
6

?
--
Peter Scott
Pacific Systems Design Technologies


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About