good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Putting text file into a hashby binf-jw (Monk) |
on Oct 17, 2008 at 09:04 UTC ( [id://717698]=note: print w/replies, xml ) | Need Help?? |
Personally I write your code like this:
Alot of coding practices are personal preference but there are some good guidelines to follow. I would say always use lexical variable for file handles. You can assign a lexical fh by opening as i've done or by using the glob from the symbol table like this: Then you can even pass it via subroutines to assign handles: Update: Just seen ikegami has already got there with this, But oh well. note: $OS_ERROR is the same as the $! that he mentioned. Update: added: '-no_match_vars' :P John
In Section
Seekers of Perl Wisdom
|
|