On Oct 22, 2:45 am, [EMAIL PROTECTED] (Michael Alipio) wrote:

> The output should be a dictionary file that is minimum
> 6 characters and maximum 15 characters with at least 4
> letters and 2 numbers in it.. no special characters
> whatsoever.. This should be a simple regex but it's
> been a while since i wrote my last regexp program.
> Need to refresh my perl basics a little bit..

Don't fall into the trap of trying to express every one of your
requirements as one giant regexp.  There's no reason for that.

> So far I got this:
>
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> my $wordlist = shift @ARGV;
> #my $newwordlist = shift @ARGV;
>
> open INPUTFILE, "$wordlist" or die $!;
> #open OUTPUTFILE, ">$output" or die $!;
>
> while (<INPUTFILE>){

next unless /^[a-z0-9]{6,15}$/;
next unless tr/a-z// >= 4;
next unless tr/0-9// >= 2;

> print;
> }


Paul Lalli


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to