> Below is part of some code that reads from a file to an array and then
> attempts to assign the array to a hash.  I get no compiling errors, but
> %label_hash is empty. No doubt I am being stupid. Has anyone a
> suggestion how to fill the hash variable?

        Well, I'm not totally certain what you're trying to
accomplish, but here's an idea of something I frequently do along the
same lines.

foreach $value (@array) {
  $scalar_array .= "$value|";
}
chop($scalar_array);
my %hash;
$hash{some_key} = $scalar_array;

        Then if you want to get the array from the key's value later
on, you just split(/\|/,"$hash{some_key}"). I typically do this when
writing berkley db's which need to have variable length arrays as the
values of a list of keys. You'll have to pick a delimiter that won't
exist within $value.

===================
 Shaun Fryer
===================
 London Webmasters
 http://LWEB.NET
 PH:  519-858-9660
 FX:  519-858-9024
===================



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to