creating variable names within a perl script
- From: "bdz" <bdalzell@xxxxxxx>
- Date: 16 Jul 2006 12:14:25 -0700
This has been bothering me for years and I think my problem is I do not
know the proper way to ask the question.
Say I want to create an open ended set of variables - I do not know how
many I will have when the script asks me to start entering them.
so i can do something like this:
while (-1){
print "enter a variable: ";
$var =<STDIN>;
chomp($var);
# what i want to do at this point is give this variable a name such
# as $var1, then when the loop comes around again I would like
# to be able to give the next variable a different name but since
# I do not know how many are being entered i cannot create the
# names ahead of time. is there anyway to create variable
# names on the fly in perl ?
exit if $var eq '-1
}
.
- Follow-Ups:
- Re: creating variable names within a perl script
- From: Jürgen Exner
- Re: creating variable names within a perl script
- From: Dr.Ruud
- Re: creating variable names within a perl script
- Prev by Date: FAQ 3.4 How do I find which modules are installed on my system?
- Next by Date: Re: creating variable names within a perl script
- Previous by thread: FAQ 3.4 How do I find which modules are installed on my system?
- Next by thread: Re: creating variable names within a perl script
- Index(es):
Relevant Pages
|
|