#!/usr/bin/perl $vowels = 'aeiouy'; $cons = 'cbdfghjklmnpqrstvwxzy'; %map = (C => $cons, V => $vowels); # init map for C and V for $class ($vowels, $cons) { # now for each type for (split //, $class) { # get each letter of that type $map{$_} .= $class; # and map the letter back to the type } } for $char (split //, shift) { # for each letter in template word $pat .= "[$map{$char}]"; # add appropriate character class } $re = qr/^${pat}$/i; # compile the pattern print "REGEX is $re\n"; # debugging output @ARGV = ('/usr/share/dict/words') # pick a default dictionary if -t && !@ARGV; while (<>) { # and now blaze through the input print if /$re/; # printing any line that matches }
Fr Jul 30 13:54:24 CEST 2021
patent_button.gif valid-html401.png elektra.jpg fsfe-logo.png valid-css.png vim.gif anybrowser.gif