Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
The stupid question is the question not asked
 
PerlMonks  

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


Comment on Re: Argument isn't numeric in hash element
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2014-04-17 22:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (458 votes), past polls