Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Problem with accessing hash Module::CoreList::version with $]

by betterworld (Deacon)
on Apr 24, 2009 at 09:57 UTC ( #759770=note: print w/ replies, xml ) Need Help??


in reply to Problem with accessing hash Module::CoreList::version with $]

Apparently, this special variable is only a string in perl 5.10, even though the documentation seems to suggest that it be a floating point number. If you use $]+0 in your example, it'll work (which is kind of strange because ordinary hash keys are converted to strings anyway, but in this case I think we are dealing with a tied hash).

% perl5.8.8 -we 'use Devel::Peek; Dump $]' SV = PVNV(0x9f664d0) at 0x9f63ed0 REFCNT = 1 FLAGS = (NOK,POK,READONLY,pNOK,pPOK) IV = 0 NV = 5.008008 # <-- in 5.8 it was a number PV = 0x9f7d250 "5.008008"\0 CUR = 8 LEN = 12 % perl5.10.0 -we 'use Devel::Peek; Dump $]' SV = PV(0x9457198) at 0x946a610 REFCNT = 1 FLAGS = (POK,READONLY,pPOK) PV = 0x945e538 "5.010000"\0 CUR = 8 LEN = 12


Comment on Re: Problem with accessing hash Module::CoreList::version with $]
Select or Download Code
Re^2: Problem with accessing hash Module::CoreList::version with $]
by Anonymous Monk on Apr 24, 2009 at 10:13 UTC
    Actually that makes no difference, works just fine in 5.10. His problem is he expect Data::Dumper output to be identical. Maybe if he use $Data::Dumper::Sortkeys ... or this
    #!/usr/bin/perl use strict; use warnings; use Module::CoreList; use Data::Dumper; $Data::Dumper::Sortkeys=1; print Dumper( $Module::CoreList::version{ $] }, $Module::CoreList::version{ "$]" }, $Module::CoreList::version{ 5.010000 } ); __END__ $VAR1 = { 'AnyDBM_File' => '1.00', ..... }; $VAR2 = $VAR1; $VAR3 = $VAR1;
Re^2: Problem with accessing hash Module::CoreList::version with $]
by XooR (Beadle) on Apr 24, 2009 at 10:39 UTC
    betterworld sad:
    Apparently, this special variable is only a string in perl 5.10, even though the documentation seems to suggest that it be a floating point number. If you use $]+0 in your example, it'll work (which is kind of strange because ordinary hash keys are converted to strings anyway, but in this case I think we are dealing with a tied hash).
    Thanx, that's solved it. I will read about tied hashes and see if this is a problem.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2014-09-15 03:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (145 votes), past polls