sub hexmap{ map{sprintf '%02X', $_} unpack 'C*', shift } *he = *hexmap; my $h = *hexmap; print he('ä'); print $h->('ä');