http://www.perlmonks.org?node_id=362768


in reply to Argument isn't numeric in hash element

Do you use pseudo hashes? I could reproduce your error message using v5.8.4:

#!/usr/bin/perl -l use warnings; no warnings 'deprecated'; use strict; my $fieldnum = 1; my $hashref = [ { $fieldnum => '$/ 1l' } ]; my $value = $hashref->{ $fieldnum }; print $value;

If you're using pseudo hashes: That's not the way it works. The first element of your pseudo hash array is an anonymous hash with keys as names to get access to the array indices mentioned as hash values. You get access to arrays using indices, so the values must be numeric.

Pseudo hashes are deprecated as of v5.8.0, quoting perl58delta:

The fields pragma interface will remain available. The restricted hashes interface is expected to be the replacement interface (see Hash::Util). If your existing programs depends on the underlying implementation, consider using Class::PseudoHash from CPAN.

I don't know if that's the thing you're doing, so I can't provide any solution so far.

-- Frank