Category Archives: Perl

Evil Hack of the Day

MacOS plist XML files are evil; even more so than regular XML. For instance, my iTunes library file consists mostly of entries like: <key>5436</key> <dict> <key>Track ID</key><integer>5436</integer> <key>Name</key><string>Getting Better</string> <key>Artist</key><string>The Beatles</string> <key>Composer</key><string>Paul McCartney/John Lennon</string> <key>Album</key><string>Sgt. Pepper’s Lonely Hearts Club Band</string> … Continue reading

Posted in Hacking, Perl | Tagged , , , , | 4 Comments

Quick and Dirty Perl Hack: Is Foo::Bar Installed?

Every so often, I need to find out whether I have a certain Perl module installed. Usually it’s either because of a security alert, or because I’m wondering how much of a pain it would be to install some package … Continue reading

Posted in Perl | Leave a comment

Don’t Put Information in Two Places

While playing around with a Perl script to look up stock quotes, I kept getting warning messages about uninitialized values, as well as mising data in the results. I eventually tracked it down to a bug in an old version … Continue reading

Posted in Hacking, Perl | Tagged | Leave a comment

I Get Email

Apparently, having my name in CPAN is a sign that I know everything about Perl, SOAP, XML, and security. Unless someone can come up with a legitimate reason to send 5000 authentication requests to a web server (including an explanation … Continue reading

Posted in FFS, Hacking, Perl | 7 Comments

Pattern Substitution as Funky Iterator

I have a project in which I have a row of cells, and a number of segments of given lengths, and I need to try out all of the ways in which the segments can fit into the row. If … Continue reading

Posted in Perl, Things I've Learned | Leave a comment

Removing Accents in Strings

I’ve been ripping and encoding a bunch of music. Since I’m a hacker, naturally I have scripts that take a file with artist, album title, and track titles, and finds the corresponding .wav or .aiff source files, encodes them as … Continue reading

Posted in Perl, Things I've Learned | 6 Comments

How Do You Spell the Names of the Months?

One construct that I’ve seen (and used) a lot in Perl is a hash that maps month abbreviations to numeric values that can be fed to POSIX::strftime: our %months = ( “jan” => 0, “feb” => 1, “mar” => 3, … Continue reading

Posted in Perl, Things I've Learned | Tagged , , | Leave a comment