in reply to Repeating Code - there has GOT to be a better way!

I see two possible solutions:
  1. Although you cannot change the files, nobody says you have to use them "as is": you could pre-process them and turn them into a more workable data-format and then work with this data; or
  2. You could write a subroutine that takes two arguments: the first is the <name> and the second is the %<name>Cmd hash:
    sub process { my ($name, %Cmd) = @_; $ApidOffset = $Application{$name}{AppApidOffset}; foreach $cmd (keys %Cmd) { if (int($fssbCmd{$cmd}{fixed_pattern}) <= 15) { $opcode = sprintf("0%x",$Cmd{$cmd}{fixed_pattern}); } else { $opcode = sprintf("%x",$Cmd{$cmd}{fixed_pattern}); } $apid = sprintf("%x",$ApidBase+$ApidOffset); $cmdData{$cmd} = {opcode => "0x$opcode", apid => "0x$apid"}; }; }
    Of course you will still have 11 subroutine calls to make, but I think you can survive that!

Update: fixed a typo in the subroutine (%Cmd instead of %cmd)

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James