in reply to Function to produce formatted ord values of a string
Being as this is Perl we are using I'd ponder using a regular expression:
sub new_regex { my $buf = shift; $buf =~ s/(.)/sprintf '%3d ', ord($1)/ge; chop $buf; return $buf; }
The chop is needed for the test to remove a trailing space and may not be needed in a "real" application.
|
|---|