|There's more than one way to do things|
@array is valid??by jdklueber (Beadle)
|on Aug 04, 2003 at 18:49 UTC||Need Help??|
jdklueber has asked for the
wisdom of the Perl Monks concerning the following question:
I thought I knew what I was doing. I thought that 7 years of coding Perl would've taught me most of the tricks... or, at least, brought me the insight to explain this little puzzle. A coworker brought this to my attention:
Given an array...
@foo = (1,2,3);
I thought that this would be invalid Perl, yet it works. Given that you declare @foo, it even works under strict (though warnings will generate a message like "Scalar value @foo better written as $foo at C:\WINDOWS\DESKTOP\FOO.PL line 6.").
Anyone have an explanation of this behavior?
Fixed square brackets - dvergin 2003-08-04