Solution #3 - Two Parts
sub two_parts { my $s = shift; if ($s =~ /^(.*)\.([^\.]*)$/) { my ($l, $r) = ($1, $2); $l =~ tr/.//d; return "$l.$r"; } else { return $s; } }
TATMWTDI | There are too many ways to do it | #8 |
sub two_parts { my $s = shift; if ($s =~ /^(.*)\.([^\.]*)$/) { my ($l, $r) = ($1, $2); $l =~ tr/.//d; return "$l.$r"; } else { return $s; } }
Copyright © 2005 Shlomi Fish |