in reply to Hash not working as intended

If $pbxex is the starting number, you probably want something like this:

if (exists $hash{$_} ) { $hash{$_}++; } else { $hash{$_} = $pbxex; }