http://qs321.pair.com?node_id=629250


in reply to Summing repeated counts for items stored in separate file

Hi dmorgo.

Perhaps a minor point but I felt as though declaring lexical variables in a 'collective fashion':
my ( $key,$value ); # or... my ( %tips_by_name, %av_by_name, %max_by_name, %min_by_name );

might lead to a state of frustration at some point. If one wishes to initialize one of the variables listed, it would be inconvenient to do so. Instead, I would advocate structuring your code like this:

my $key = ''; my $value = ''; my %tips_by_name = ''; my %av_by_name = ''; my %max_by_name = ''; my %min_by_name = '';


Initializing one or more of the variables listed above to another value would now be trivial.

Hope this helps,
~Katie