Re: PERL creating variable names with other variable values.

by "W. Jeffrey Rankin" <jrankin(at)jeffr.net>

 Date:  Tue, 6 Feb 2001 08:37:24 -0500 (EST)
 To:  Peter Newton <c-newton(at)ihug.co.nz>
 Cc:  hwg-techniques(at)hwg.org
 In-Reply-To:  karlnewt
  todo: View Thread, Original
I'm not exactly sure what you're trying to do, but would it be better to
create your $day variable as an array?

- Jeff

===================================================
Jeff Rankin	jrankin(at)jeffr.net

http://www.jeffr.net/

Be Valid To Be Cool
===================================================

On Tue, 6 Feb 2001, Peter Newton wrote:

> Hello list members,
> 
> I hope I can make this question clear, I'm trying to create (using PERL) a
> number of variables using a loop and a count so that I can use the count
> value to append to the variable name like so:
> 
> for ($day=1; $day <= 31; ++$day) {
>  $dec1 = ........ blah blah;
> }
> 
> But I want the variable $dec1 to go to $dec2 etc each time round the loop.
> using $day to append the appropriate digit to the variable name $dec.
> 
> I've tried:-
>  $dec$day
> "$dec"."$day"
> etc etc
> 
> I'm sure I've done this before but cannot find anything.
> Can anyone help??
> 
> many thanks
> Peter Newton
> 
> 
> 

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.