Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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 browsing the Monastery: (6)
As of 2014-09-20 12:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (159 votes), past polls