Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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 cooling their heels in the Monastery: (3)
As of 2015-07-06 04:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls