![]() |
|
Perl: the Markov chain saw | |
PerlMonks |
Re: Hash checkingby GrandFather (Saint) |
on Apr 25, 2007 at 21:08 UTC ( #612097=note: print w/replies, xml ) | Need Help?? |
There are a few small items worth pointing out. As can be seen in the sample below, DATA is special: avoid using it in other roles to avoid confusion. It is strongly recommended that you use the three parameter version of open. The intent is clearer and where a file name is provided the three parameter open is much safer. It looks like open (INFILE, '<', 'AXP_FACS.DAT'); (many people omit the parentheses). Using a Perl for loop is generally much preferred over the C style for. Combined with the range operator the intent is much clearer and less prone to off by one errors: for (1 .. 5000) {. A cleaned up version of the code might look like:
Prints:
An interesting variation of the print loop that you might like to ponder is:
DWIM is Perl's answer to Gödel
In Section
Seekers of Perl Wisdom
|
|