Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Argument isn't numeric in hash element

by haoess (Curate)
on Jun 09, 2004 at 15:17 UTC ( #362768=note: print w/replies, xml ) Need Help??

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://362768]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2018-03-18 10:26 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (229 votes). Check out past polls.