1/ discover perltidy and use it.
2/ Don't make variables needlessly global and don't declare anything before you need to. For example, declare @dates immediately before the while loop where it is populated. @rain and @snow are not used globally at all and in fact are redeclared inside a loop - that is just plain nasty! @hlahdd is used in a very small context, but is declared globally.
3/ Use lexical file handles and good variable names generally. If FH were called $outFile the various comments describing FH's use would be redundant.
4/ Avoid redundant interpolation - push @dates, "$start"; is better written push @dates, $start;.
5/ Only the first element of @rain is used. Replace it with a scalar instead. The assignment becomes: my ($rain) = $page =~ /.../;. Ditto @snow, @depth, @hdd and @hlahdd.
6/ built in functions such as open, close, push and shift don't require parenthesis and are generally used without them.
In reply to Re: Improve My Code...
by GrandFather
in thread Improve My Code...
by cheech
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |