Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

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. :)


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://160549]
[Discipulus]: see you monks!
[Lady_Aleena]: shmem, let me get this sub rewritten, then I will look into how to use ctags in geany. Deal? 8)
[shmem]: Discipulus: yeah, that might eventually prepare the path for OO ;-)
[Lady_Aleena]: See you, Discipulus.
[shmem]: Lady_Aleena: that's up to you. I only wanted to show you a path that might be more comforting than command line grep ;-)
[Lady_Aleena]: shmem, I don't think any of my modules could be converted to OO. They are too procedural.
[Lady_Aleena]: Now I will see if my perl-fu is as bad as I think it is.
[shmem]: ah, geany uses its own idea of tags. Ah well...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2017-04-27 12:31 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (506 votes). Check out past polls.