CamelCase in Perl

Example for versions perl 5.12.1, perl 5.8.8
my $text = <STDIN>;
$text = join('', map(ucfirst, split(/[^a-z]+/, lc $text)));
print $text, "\n";