Angie Ahl wrote:
> 
> Hi people

Hello,

> I'm trying to create a hash of arrays of arrays and I'm having a mind
> twisting time with references.
> 
> my $key = "some_varying_text"
> my %pathhash;
> my @link = ($LinkUrl, $LinkTitle);
> 
> I'm trying to set $pathhash{$key} to an array that contains the array
> @link.
> ie there will be multiple @link arrays in $pathhash{$key}.
> 
> I just can't work out how to assign an array ref to an array ref to a
> hash element. I think that's right.
> 
> Any clues anyone... please, 4 hours down and a lot of RTFM'ing hasn't
> helped (quite the opposite actually;)

If @link is lexically scoped then use a reference:

$pathhash{ $key }[ 0 ] = [EMAIL PROTECTED];
# or
push @{ $pathhash{ $key } }, [EMAIL PROTECTED];


If not then you have to copy it to an anonymous array:

$pathhash{ $key }[ 0 ] = [ @link ];
# or
push @{ $pathhash{ $key } }, [ @link ];



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to