use strict; use warnings; my $input = ; chomp $input; my $file = 'wordlist.txt'; open(INFO, $file); my @lines = ; close(INFO); for my $word (@lines){ if ($word =~ /^[$input]+$/){ print "$word\n"; } }