Beefy Boxes and Bandwidth Generously Provided by pair Networks httptech
There's more than one way to do things
 
PerlMonks  

Re: Problems with array references and 'use strict'

by hanenkamp (Pilgrim)
on Dec 02, 2003 at 09:35 UTC ( [id://311627]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Problems with array references and 'use strict'

Your problem is in the line reading:

$vectorRef = { 'time' => \(), 'data' => \() };

Using \() is like trying to take the address of nothing and it appears that Perl does in fact interpret this as nothing. Actually, It almost seems like this should be a warning, but use warnings doesn't complain. Running it in the perl debugger (via the -d switch) shows $vectorRef to contain the following:

0 HASH(0x8162084) 'time' => 'data'

Obviously, this isn't what you meant. The solution is to change each \() to [] which is the anonymous array reference constructor (less line noise too). This would make the code read:

$vectorRef = { 'time' => [], 'data' => [] };

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://311627]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.