Here's how I would do it, with just a modification of your regex.
use strict; use warnings; my $input = <STDIN>; chomp $input; my $file = 'wordlist.txt'; open(INFO, $file); my @lines = <INFO>; close(INFO); for my $word (@lines){ if ($word =~ /^[$input]+$/){ print "$word\n"; } }
Udate: I may have misinterpreted the OP. This obviously will not work if all six input characters must be used.
In reply to Re: Simple regex wordlist question
by hangon
in thread Simple regex wordlist question
by escherist
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |