B
bdz
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
}
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
}