#!/usr/bin/perl -w use strict; my $name = shift; &cz_vocativ_mask($name); sub cz_vocativ_mask { my $name = shift; # Important! The longest suffixes must be the last ones in this list. my %sufdata = ( a => 'o', s => 'si', k => 'ku', ar => 'ari', ic => 'ici', ec => 'ce', ek => 'ku', er => 'ere', # vec => 'evce', vec => 'veci', # Michal Svec is saying he likes this better ); foreach my $suffix (keys %sufdata) { if($name =~ /^(.*)$suffix$/) { print "Suffix $suffix -> $1$sufdata{$suffix}\n"; return; } } print " no rule apply -> $name\n"; }