in reply to Hash not working as intended

... chomp; $hash{$_}= $pbxex-1 if (not exists $hash{$_}); $hash {$_} ++; ...

This is one way, initizalize the hash with your base value whenever you want to increment a value that wasn't accessed yet. In this case the base value is one less than the starting value because there is an increment following the initialization

Another way would be to add 2 to every value in the hash after you read in all values from the file:

... chomp; $hash {$_} ++; } foreach (keys %hash) { $hash{$_}+= $pbxex-1; print PBXNUM1 "$_$hash{$_}\n"; }

Replies are listed 'Best First'.
Re^2: Hash not working as intended
by ddrew78 (Beadle) on Feb 28, 2011 at 15:40 UTC
    Great, that works perfectly...thanks for the help