CodeJunkie has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
This might seem like a stupid question so i'm sorry if it's been asked before, but I want to be able to store an array of variables, then loop though all these variables and perform a simple substition.
I thought the code would look something like this:
my @elements=(\$hall_name,\$contact_name,\$contact_email,\$contact_tel +ephone); foreach my $line (@elements) { print "$line<br/>"; $line=~s/'//g; }
This was a pretty wild guess because i'm not really used to using references, so I think i'm probably quite wide of the mark, but can anyone tell me how to do this,or a better way if there is one?
cheers,
Tom
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Storing an array of variables
by Mr. Muskrat (Canon) on May 20, 2003 at 18:32 UTC | |
|
Re: Storing an array of variables
by pzbagel (Chaplain) on May 20, 2003 at 18:43 UTC | |
|
Re: Storing an array of variables
by omnibus (Scribe) on May 20, 2003 at 18:36 UTC | |
|
Re: Storing an array of variables
by cees (Curate) on May 20, 2003 at 19:01 UTC | |
|
Re: Storing an array of variables
by fglock (Vicar) on May 20, 2003 at 19:20 UTC | |
|
Re: Storing an array of variables
by Jenda (Abbot) on May 20, 2003 at 21:53 UTC | |
by CodeJunkie (Monk) on May 21, 2003 at 16:11 UTC | |
|
(jeffa) Re: Storing an array of variables
by jeffa (Bishop) on May 21, 2003 at 05:53 UTC |