use strict; use warnings; my @strs = qw{smpl95 smpd9 fuj324}; foreach my $str ( @strs ) { print qq{Original: $str\n}; my $numStr = there($str); print qq{Numified: $numStr\n}; my $decoded = backAgain($numStr); print qq{ Decoded: $decoded\n}; print q{-} x 25, qq{\n}; } sub there { my $str = shift; my $numStr; $numStr .= sprintf q{%03d}, ord for split m{}, $str; return $numStr; } sub backAgain { my $numStr = shift; (my $str = $numStr) =~ s{(...)}{chr $1}eg; return $str; }