I'm sure this is simple but I'm getting more and more confused:
I want to validate input so that it is either:
   a valid dos filename (we still use it)
   up to 12 alphanumeric characters (inc spaces)
   nothing (in which case 'none' would be entered by default

Here's my snippet:
#!/usr/bin/perl
use strict;
my $file;
print "\nType filename [8.3] or [enter] for none: ";
while (<STDIN>){
        chomp;
        # last if ((/^\S{1,8}\.\S{0,3}/)or(/^\w{1,12}/));
        last if (/\w{1,12}/);
        print "try again: "
}
print "approved";

Testing the above I realised that (/\w{1,12}) was allowing more than
12 alphanumeric characters (I've commented out the first
'last if' to test on it's own) and I'm not sure why. I've been stuck
on this for a considerable time so I'd really appreciate someone's
insight into my errors.


(DOS regexp was supplied by 'Steve Litt's PERLs of Wisdom')

-- 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to