#!/usr/bin/perl -w use strict; foreach my $str (qw(fish apple license gradual canaan)) { print sr($str,'s/([aeiou])/\u$1/g'),"\n"; } sub sr { my($in,$re)=@_; eval "\$in =~ $re;"; $@ and die "Bad regex '$re'\n"; $in; }