Hi all,
Please forgive the newbie nature of this question but i'm just starting off
teaching myself perl from scratch and so need a little clarification.
I am trying to put together a script to do pattern matching and while I can get
the basic syntax alright it doesn't seem to be working as expected. For one
example I need to match a user input and make sure it is a certain length (i.e.
doesn't exceed a certain number of characters) and this is the code so far:
while ($string != m/[a-zA-Z]{1,5}/ )
{ print("that is wrong....try again: ");
chomp ($string = <STDIN>); }
So while I can appreciate this is probably a case of not bracketing it properly
or slightly wrong implementation I would appreciate some guidance. It will
check and doesn't like numbers but while an error occurs if no characters are
entered it will accept input even if it is over 5 characters...so I need to
know what to put after this to limit the end of input.
Thank you
Mark
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>