These are generalized tr like functions which convert a list to a string (pack) or string to list/array (unpack) according to a template |
We can illustrate with a fragment from a CGI script that reads and interprets data sent to a server in the peculiar application/x-www-form-urlencoded coding scheme |
$value =~ tr/+/ /; # Convert + back to blanks |
$value =~ /%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))//eg; |