From: Paul Branston <[EMAIL PROTECTED]>
> I need to fill a number of arrays of arrays with data from a data
> file. I would like to give the arrays a name which is generated from a
> variable which comes out of the datafile. My code at the moment sets a
> variable $trunkname then I tried doing
> 
> push @$trunkname, $row[1];
> 
> but it is not making an array with the name which I intended and from
> reading the Camel book I think I am getting a reference to something
> else. 

Please read
        Why it's stupid to `use a variable as a variable name'
        http://www.plover.com/~mjd/perl/varvarname.html

You should use a hash of arrays:

        my %data;
        ...
        push @{$data{$trunkname}}, $row[1];

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


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

Reply via email to