Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
    1. No contest: column_names.

    2. Definitely no rewinding magic. In fact, I wouldn’t even include a column_names_from_line sugar method, because all it does is save five keystrokes on a rare operation for the price of concealing how that works. And that’s the only reason users might forget about having to call that method first thing.

      If you just tell them that they need to set up the column names manually (and here’s an easy way to take them from the first line of the file), then it’s pretty much impossible to get confused about it, because, well, you have to set the column names before hashrefs will work, and if you want the names to come from the file, well, you have to take them from the file, and to take them from the file, well, you have to do that right away if they’re on the first line.

      So if you include no magic whatsoever, the interface will be clearer, because the correct way of using it will inescapably suggest itself. And it’s not so much typing that it might matter.

    • Thanks for the feedback. I'll lean towards not proposing the sugar method for the reasons you give.