On Tue, 10 Jun 2003, alex p wrote: > All, > I am really bad at REGEX's and am in need of help! > I have a script that asks for users input but I need to check that the input > begin with "MDS(and a number 0-9)" before proceeding > > below is something like what I am doing: > > print "ask for input"; > chomp ($answer=<STDIN>); > #(not sure which one to use below) > while/unless/if > $answer does not begin with "MDS[0-9] (and a number 0-9) > { keep asking for answer }; >
I'd do it like this: while($answer !~ /^MSD\d$/) { print "ask for answer\n"; chomp($answer=<STDIN>); } **** [EMAIL PROTECTED] <Carl Jolley> **** All opinions are my own and not necessarily those of my employer **** I'd do it like this: while($answer !~ /^MSD\d$/) { print "ask for answer\n"; chomp($answer=<STDIN>); } **** [EMAIL PROTECTED] <Carl Jolley> **** All opinions are my own and not necessarily those of my employer **** I'd do it like this: while($answer !~ /^MSD\d$/) { print "ask for answer\n"; chomp($answer=<STDIN>); } **** [EMAIL PROTECTED] <Carl Jolley> **** All opinions are my own and not necessarily those of my employer **** _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs