Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: something about improving code...

by reptile (Monk)
on Jun 28, 2000 at 02:30 UTC ( #20096=note: print w/ replies, xml ) Need Help??


in reply to something about improving code...

For your flip, you don't even need to use a reference. Modifying @_ in a subroutine also modifies the variables in the argument list. You could say this:

sub flip { $_[0] = !($_[0]) } # $foo will be modified below flip($foo);

I'm not positive about this but AFAIK since that's a one line subroutine, perl will optomize by inlining the subroutine, and be even faster. Still, $foo = !$foo; isn't that hard to write directly. Whatever you prefer.

72656B636148206C72655020726568746F6E41207473754A


Comment on Re: something about improving code...
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (13)
As of 2015-07-06 17:19 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 (77 votes), past polls