Re:Perl tutorials suck (and cause serious damage)
by kgtm on Wednesday October 26, 2011 @12:34PM
(#3159310)
Absolutely! Running the code under Strawberry (5.12.3) produces no warnings and "works" as one would expect. Can it be any easier to shoot yourself in the foot? Regardless, Perl has a special place in my heart.
Re:Perl tutorials suck (and cause serious damage)
by chromatic on Wednesday October 26, 2011 @02:02PM
(#3159695)
... since you're only returning one element in that array, this should probably be "${$ref}[0]" which returns a scalar only.
It's perfectly fine to use the array sigil, in which case it's a one-element list instead of a scalar. That's useful sometimes.
This example proves nothing about Perl's power, though. The fact that difficult and fiddly reference handling shenanigans are necessary to handle something as trivial as nested arrays and hashes shows quite the opposite.