creating variable names within a perl script



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
}

.



Relevant Pages

  • Re: Halfway point? - resto update
    ... > proper - what matter if a few typos creep in, ... Butt I can easily blame the spiel chequer four knot bothering to tripe ...
    (uk.rec.motorcycles.classic)
  • Re: Event Question
    ... they wish to abort. ... Then branch to the proper place in your code. ... > then just wants to exit, now they are not able to close the form becuase ...
    (microsoft.public.access.formscoding)
  • Re: [kde] close konsole window == exit?
    ... about as proper as if you had unplugged the cable I would imagine. ... If you know you're going to log off the local machine after you SSH session, ... when you type exit on the remotehost it will exit with a status 0 and then ...
    (KDE)
  • Re: small script question. need proper syntax
    ... (all I want is the proper way to sent it ... below it would at least load one image that I define as a default image. ... var Wvalue= ...
    (microsoft.public.frontpage.client)
  • Re: Broke my downloading record
    ... >> won't involve using about 20 or so discs to do a proper backup (although ... stuff in due to me not bothering to point it elsewhere), ... probably only bother with an 80GB hard disk. ... Called Pete? ...
    (uk.rec.cars.modifications)