Hi Dylan
"Dylan Boudreau" <[EMAIL PROTECTED]> wrote in message
004c01c2b8cd$0920dbb0$0400a8c0@dylan">news:004c01c2b8cd$0920dbb0$0400a8c0@dylan...
> I am trying to make a small menu for a script and the options are 1 or 2
> or 9. I have it written like this
>
> until ($selection == '1|2|9'){
>
Thanks everyone, for some reason a regexpr never came to mind.
Good thing its Friday,
Dylan
-Original Message-
From: Dan Muey [mailto:[EMAIL PROTECTED]]
Sent: January 10, 2003 1:35 PM
To: Dylan Boudreau; [EMAIL PROTECTED]
Subject: RE: menu
You need a regular expression like
Until
You need a regular expression like
Until ($selection =~ m/^1$|^2$|^9$/) {
Do some stuff
}
The ^ and $ keep them from enterin say '12' or '109' or 'I love 1 monkey'.
Remove them if you only care that they at least type the digit and don't care if
there's extra stuff
Dan
-Original Message--
this worked for me.
#!/usr/bin/perl -w
until ($selection=~/[129]/){
print "Hello\n";
$selection = 1;
}
I tried 1239.
129 print "hello" once.
3 is endless hello loop.
Or you can do
until (($selection==1)||($selection==2)||($selection==9)){
code;
}
hope that helps.
> -Origin
Dylan Boudreau wrote:
> I am trying to make a small menu for a script and the options are 1
> or 2 or 9. I have it written like this
>
> until ($selection == '1|2|9'){
> do some stuff
> }
>
>
> and it wont work. I know it is something simple but I am a little
> simple myself today and don