
I decided one day that I want to master Perl's pack() and unpack() functions to be able to manipulate data in Perl efficiently.
Perl's pack and unpack are two functions for transforming data according to a user-defined template, between the guarded way Perl stores values and some well-defined representation as might be required in the environment of a Perl program. Unfortunately, they're also two of the most misunderstood and most often overlooked functions that Perl provides.
As I wrote before, my way of learning these complex functions were to make a cheat sheet first with all the template parameters and then just spend a day reading more about them and experimenting.
As I usually print cheat sheets two pages per side and the pack/unpack cheat sheet consumed just one page, I added Perl's printf/sprintf format and attribute summary.
Here is how I printed this cheat sheet:
Download Perl's pack/unpack and printf Cheat Sheet
PDF:
Download link: perl's pack/unpack and printf cheat sheet (.pdf)
Downloaded: 77761 times
Microsoft Word 2000 format (.doc):
Download link: perl's pack/unpack and printf cheat sheet (.doc)
Downloaded: 2472 times


Hacker Newsletter - a weekly newsletter of the best articles on startups, programming, and more. All links are curated by hand from Hacker News.
Twitter
Facebook
Plurk
more
GitHub
LinkedIn
FriendFeed
Google Plus
Amazon wish list
Comments
Thanks!
My perl cheat sheet compilation has been updated with this one per your request :)
http://www.scottklarr.com/topic/106/perl-cheat-sheets/
Handy cheat sheet, ta! Could benefit from a few examples at the end, but dead useful information nonetheless. Smart!
Leave a new comment