# your number 1 uses "if (not ...)" # which is equivalent to "unless (...)" # 4 unless (exists $sheets{$machine_sheetname}) { $sheets{$machine_sheetname} = 1; } # but I'm not really sure why you're checking for existence at all. # just incrementing the value is the simplest approach. # 5 $sheets{$machine_sheetname}++;