Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Hashrefs and arrayrefs

by stephen (Priest)
on Apr 19, 2002 at 14:17 UTC ( #160549=note: print w/ replies, xml ) Need Help??


in reply to Hashrefs and arrayrefs

Your problem is that you are pushing the same variable reference into to list over and over. You need to localize %info with my, like so:

...snip... foreach $dir(@dirlist) { my %info; my $newdir=($dest."\/".$dir); if (-f $absdir."\/".$dir) { %info=( driver =>"working", ...snip...
It's an easy mistake to make... unless you've got use strict running. Turn on use strict. :)

stephen


Comment on Re: Hashrefs and arrayrefs
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (14)
As of 2015-07-02 09:18 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 (33 votes), past polls