Basic HTML version of Foils prepared Sept 20 97

Foil 52 pack and unpack Functions -- I

From Perl5 and Advanced Perl4 Features Computational Science for Information Age Course CPS616 -- Sept 20 97. by Geoffrey C. Fox,Nancy McCracken,Tom Scavo


1 These are generalized tr like functions which convert a list to a string (pack) or string to list/array (unpack) according to a template
2 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
3 $value =~ tr/+/ /; # Convert + back to blanks
4 $value =~ /%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))//eg;

in Table To:


© 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 Sun Apr 5 1998