Welcome to the Monastery | |
PerlMonks |
Re: A more elegant use of unpackby clscott (Friar) |
on Sep 03, 2004 at 16:42 UTC ( [id://388339]=note: print w/replies, xml ) | Need Help?? |
Just a personal preference but I would do:
My changes keep the field names and the field unpack definitions closer together, puts the values into a hash with the appropriate named keys and removes repeated code for the printing (use formats if you want better alignment in the columns). It may be important to note that this is not as efficient as the way you are currently doing it. As wfsp noted your 'a's should be 'A's and you are one character off in the 5th field (counting from one). Additionally your regexp in the elsif line does not match any of your sample data lines.
-- Clayton
In Section
Seekers of Perl Wisdom
|
|