Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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
Replies are listed 'Best First'.
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.
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;

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 cooling their heels in the Monastery: (8)
As of 2015-07-30 00:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls