in reply to Process a set num of characters at a time

Another approach (assumption: string is one byte per character):
>perl -wMstrict -le "for my $in (@ARGV) { my @nuxi = map sprintf('%04x', $_), unpack 'v*', $in ; print qq{$in -> @nuxi}; } " test tester teste test -> 6574 7473 tester -> 6574 7473 7265 teste -> 6574 7473
Note that this approach fails for odd-length strings. Depending on just what output you want, this can be fixed, e.g.:
>perl -wMstrict -le "for my $in (@ARGV) { my @nuxi = map sprintf('%04x', $_), unpack 'v*', $in . qq{\000} ; print qq{$in -> @nuxi}; } " test tester teste test -> 6574 7473 tester -> 6574 7473 7265 teste -> 6574 7473 0065
(This is an example of the NUXI problem.)