Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Argument isn't numeric in hash element

by haoess (Curate)
on Jun 09, 2004 at 15:17 UTC ( [id://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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://362768]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2024-04-16 10:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found