#!/usr/bin/perl
use strict;
#globale Variablen
our $vowels = 'aeiouy';
our $cons = 'cbdfghjklmnpqrstvwxzy';
our %map = (K => $cons, V => $vowels);
our $pat; # Pattern
our $re; # Regex
#Laufvariablen
my $class;
my $char;
sub debug {
my @array = keys %map;
print "Vowels: $vowels\n";
print "Cons: $cons\n";
print "Map: @array\n";
print "Pat: $pat\n";
}
for $class ($vowels, $cons) {
for (split //, $class) {
$map {$_} .= $class;
}
}
keys %map;
for $char (split //, shift) {
$pat .= "[$map{$char}]";
}
print "Pattern lautet $pat\n";
$re = qr/^${pat}$/i;
print "REGEX lautet $re\n";
@ARGV = ('/usr/share/dict/words')
if -t && !@ARGV;
while (<>) {
print if /$re/;
}