All the Perl that's Practical to Extract and Report

Navigation

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Without JavaScript enabled, you might want to
use the classic discussion system instead. If you login, you can remember this preference.

Please Log In to Continue

So here's a thought: most uses of pack should be wrapped up in a small subroutine, shouldn't they? I mean, if you are unpacking a struct, make two routines (to convert either direction) that take binary data on one end and an array, hash, or object on the other.

Whoa, boy. You've got a good idea, but you're starting to overgeneralize.

What you're talking about is properly factoring your code. Your program is made up of a string of little operations performed in a meaningful order. One of those oper

That idea alone could save buckets of time writing workarounds and useless comments.

A tradition at my old workplace persisted for years and passed on to every intern and co-op that when you wrote:

open(FILE, $filename) || die "Cant open file: $!";

you should leave out the apostrophe in the word "Can't," because that once broke something. Obviously, what it broke was somebody who tried to use single quotes for the whole thing, but that part wasn't understood.

--J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers