in reply to Re: Why should I use perl 5.10?
in thread Why should I use perl 5.10?
x operator on a list you can now say my @arr = qw(x y z) x 4
THAT ONE IS DANGEROUS! The current x operator provides scalar context to both its operands (@a = (1,2,3,3,3,3); print @a x 3; ==> 666), the new one will not. While this may seem unimportant since it's unlikely that you'd want to repeat several times the lenght of an array it may easily cause problems with things like foo(...) x 8. Suddenly the foo() will be evaluated in a different context! That might easily lead to hard to find bugs!
Update: Looks like the change is more restricted than I thought so it should not be a problem. Thanks Somni!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Why should I use perl 5.10?
by Somni (Friar) on Dec 01, 2007 at 16:17 UTC | |
|
Re^3: Why should I use perl 5.10?
by shmem (Chancellor) on Dec 01, 2007 at 16:47 UTC |