M K Scott wrote: > Hi all, Hello,
> 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>); } You need to anchor the pattern like /^[a-zA-Z]{1,5}$/ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>