in reply to Re: Counting keys in a referenced hash
in thread Counting keys in a referenced hash
for example. Perl supposes you know the length of a literally coded (i.e. hard-coded) list anyway and tries to offer you something more useful when it discovers a "Useless use of a constant in void context"...#!/usr/bin/perl use strict; use warnings; my $scalar = qw/one two three/; my @array = qw/one two three/; print '$scalar is ', $scalar, "\n"; # prints + 'three' print '@array in scalar context is ', scalar @array, "\n"; # prints + 3
|
---|