use strict; use warnings; sub consinc { my $str = shift; my %vowels = ( 'a' => 1, 'e' => 1, 'i' => 1, 'o' => 1, 'u' => 1, ); do { $str++; } while (exists $vowels{substr($str, -1 , 1)}); return $str; } my $str = $ARGV[0]; print "$str - " . consinc($str) . "\n"; #### $str++ if exists $vowels{substr($str, -1 , 1)};