Basic HTML version of Foils prepared April 16,1996

Foil 52 pack and unpack Functions -- I

From Perl5 and Advanced Perl4 Features Computational Science for Information Age Course CPS616 Material -- April 16,1996. by Geoffrey C. Fox


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;



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Sep 6 1997