Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 imbibing at the Monastery: (6)
As of 2014-10-25 02:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (140 votes), past polls