Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
P is for Practical
 
PerlMonks  

Re: Repeating Code - there has GOT to be a better way!

by brap (Pilgrim)
on Mar 31, 2010 at 17:32 UTC ( #832099=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: Repeating Code - there has GOT to be a better way!
Select or Download Code
Re^2: Repeating Code - there has GOT to be a better way!
by jedikaiti (Friar) 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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://832099]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2014-04-16 06:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (416 votes), past polls