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

Not that this answers your question, but you might be able to replace

if (int($fssbCmd{$cmd}{fixed_pattern}) <= 15) { $opcode = sprintf("0%x",$<name>Cmd{$cmd}{fixed_pattern}); } else { $opcode = sprintf("%x",$<name>Cmd{$cmd}{fixed_pattern}); }

with

$opcode = sprintf("%02x",$<name>Cmd{$cmd}{fixed_pattern});

It might help a little bit, anyway.

Replies are listed 'Best First'.
Re^2: Repeating Code - there has GOT to be a better way!
by jedikaiti (Hermit) on Apr 01, 2010 at 16:41 UTC

    Always happy to get suggestions to improve my code, and every little bit helps! Thanks!

    Kaiti
    Swiss Army Nerd