D
DnaDude
I would like to compute the number of
keys in a hash, as in below, but without
using a temporary variable.
#this works
use strict;
@foo = keys %$A;
$number = $#{@foo};
($A is a reference to a hash). So why does
$number = $#{keys %$A};
or
$number = $#{@{keys %$A}};
not work? I get the error
"Can't use string ("357") as an ARRAY ref while "strict refs" in use"
Many thanks,
Cev.
keys in a hash, as in below, but without
using a temporary variable.
#this works
use strict;
@foo = keys %$A;
$number = $#{@foo};
($A is a reference to a hash). So why does
$number = $#{keys %$A};
or
$number = $#{@{keys %$A}};
not work? I get the error
"Can't use string ("357") as an ARRAY ref while "strict refs" in use"
Many thanks,
Cev.