SPUG: Shouldn't this work?
Martin, Asa
asa.martin at attws.com
Thu Nov 29 14:14:44 CST 2001
Am I missing something, or shouldn't this syntax be valid to create a
reference to an anonymous array:
$ cat /tmp/a
#!/usr/bin/perl -w
use strict;
my $aref = qw[one two three four];
if (ref($aref) eq 'ARRAY') {
print "yes\n";
}
Useless use of a constant in void context at /tmp/a line 4.
Useless use of a constant in void context at /tmp/a line 4.
Useless use of a constant in void context at /tmp/a line 4.
To get it to work, I have to use:
my $aref = ['one', 'two', 'three', 'four'];
Then the script prints yes.
Anyone care to enlighten me on what's happening?
Thanks,
Asa Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/archives/spug-list/attachments/20011129/d59339cd/attachment.htm
More information about the spug-list
mailing list