Yeah, I thought about a loop, but I was afraid it would obscure what the code is doing - I'd certainly switch to a loop if doing more than 3 or four repetitions, and if I were doing more than two statements per offset, but at less than that the loop syntax just clutters things up. (I realize that this is a matter of personal taste, and I might change my answer depending on my mood).
Good point about using length - again, I think my way is clearer, but I'm not sure whether that's the use of length or the ->. (which you could drop)
By the way, I would have written the first line of your loop as:
$triplets{$_} = [unpack("x$_ (a3)*", $line)];
But that's only because I don't like using
@{$unusedvarref} to auto-vivify.
--
@/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/;
map{y/X_/\n /;print}map{pop@$_}@/for@/
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.