You can use symbolic references:

perldoc perlref
(see Symbolic references section)

$i=0;
While(bla bla){
        $i++;
        $a_var_name="array$i";
        $h_var_name="hash$i";
        #
        @$a_var_name=(); #this for instance clears @array1 if your are in the first 
loop.
        %$h_var_name=(); #this for instance clears %hash1 if your are in the first 
loop.
}

But I personally don't like this solution (see advices from perldoc).
May be you can think about the re-design of your data structure and use for instance:
- array of hashes
and
- array of arrays

HTH,

José.

> -----Original Message-----
> From: Dario Greco [mailto:greco@;biogem.it] 
> Sent: Wednesday, October 30, 2002 4:37 PM
> To: Perl
> Subject: variable names problem
> 
> 
> hi,
> i must create an array and an hash and store them for each 
> cycle of a "while". i want name these variables @array1, 
> @array2... and %hash1, %hash2... in which 1,2 etc are the 
> number of cycle of the "while". how is the correct grammar 
> for this case? tnx very much
> 
> 
> ___________________________
> D G
> Gene Expression Core Lab
> BioGeM S.C.a.R.L.
> Via P. Castellino, 111
> 80131   Napoli (Italy)
> Tel +39 081 6132 303
> Fax +39 081 6132 262
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


**** DISCLAIMER ****

"This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


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

Reply via email to