ddrew78 has asked for the wisdom of the Perl Monks concerning the following question:
for some reason, if a valid pattern is entered, it still asks to re-enter three times. Also, if I continue to enter an invalid pattern (2 or 5 characters), after looping twice it will continue to ask for the remainder of the inputs, as shown here:print "Customer abbreviation: "; $cust = <STDIN>; print "\n"; chomp ($cust); until($cust =~ <\w{3,4}>) { print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"; print "!!! !!!\n"; print "!!! ABBREVIATION MUST BE 3 OR 4 CHARACTERS !!!\n"; print "!!! !!!\n"; print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"; print "\n"; print "Customer abbreviation: "; $cust = <STDIN>; chomp ($cust); print "\n"; }
Any and all wisdom is greatly appreciated.Customer abbreviation: AB !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! !!! !!! ABBREVIATION MUST BE 3 OR 4 CHARACTERS !!! !!! !!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Customer abbreviation: AB !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! !!! !!! ABBREVIATION MUST BE 3 OR 4 CHARACTERS !!! !!! !!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Customer abbreviation: AB BAN Number:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem with pattern match
by kennethk (Abbot) on Jun 11, 2010 at 18:29 UTC | |
by Yary (Pilgrim) on Jun 11, 2010 at 19:05 UTC | |
by jwkrahn (Abbot) on Jun 11, 2010 at 19:25 UTC | |
by space_agent (Acolyte) on Jun 12, 2010 at 17:58 UTC | |
by ddrew78 (Beadle) on Jun 14, 2010 at 12:28 UTC | |
|
Re: problem with pattern match
by toolic (Bishop) on Jun 11, 2010 at 19:16 UTC |