[PLUG] Re: Perl
Roderick A. Anderson
raanders at acm.org
Tue Jul 4 15:33:33 UTC 2006
Randal L. Schwartz wrote:
>>>>>>"Roderick" == Roderick A Anderson <raanders at acm.org> writes:
>
>
> Roderick> You're right. I was trying to pop that off while do _too_ many other things
> Roderick> at the same time. I did test the
>
> Roderick> %passworddb = ( %passworddb, ( split ( '=', $passline ) ) );
>
> Argh. no. That continually recreates the hash by repeatedly deconstructing
> it to a list. That'd be like building a house, one brick at a time, by
> first removing all the bricks back to the truck, adding a new brick in
> the truck, then rebuilding a house. Ouch ouch. Expensive.
Darn. I know this. I forgot I had used something similar where I
wanted a pre-existing hash to overwrite another hash if the keys were
the same. Much smaller arrays to work with and it happened only once in
the script.
>
> Perhaps what you want is
>
> my ($newkey, $newvalue) = split /=/, $passline;
> $passworddb{$newkey} = $newvalue;
Yup when I'm reading in lots of stuff.
Now I'll go back to my corner and work on the other stuff.
Rod
--
More information about the PLUG
mailing list