ZZamboni has asked for the wisdom of the Perl Monks concerning the following question:
When I run it with "perl -w t2.pl" I get:@a=('a', 'b', 'c'); print "test1: ".scalar(@a)."\n"; print "test2: ".scalar(sort @a)."\n";
This is, when scalar is applied to the value returned by sort it returns undef. Does sort return something different in a scalar context? But then scalar should not be setting a scalar context, since its purpose is to get an array as argument.test1: 3 Use of uninitialized value at t2.pl line 3. test2:
What am I missing?
Thanks,
--ZZamboni
|
|---|