Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

RE: (tilly) 2 (possibilities): interchanging variables the tough way

by tilly (Archbishop)
on Aug 31, 2000 at 16:08 UTC ( #30496=note: print w/replies, xml ) Need Help??

in reply to RE (tilly) 1 (possibilities): interchanging variables the tough way
in thread interchanging variables the tough way

Looking at this bugs me.

Manipulating your input arguments this way works, but the side-effects can surprise and amaze. I would not do this lightly.

My overall feeling is that if you feel the need to rotate your data, you should have an array rather than a list of variables. Then you could

push @array, shift @array;
much faster, without resorting to nasty side-effects.

Generally when I see myself wanting to resort to "bad" techniques like side-effects, I take that as a danger sign and go looking for a more fundamental mistake in my code...

  • Comment on RE: (tilly) 2 (possibilities): interchanging variables the tough way
  • Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://30496]
[choroba]: Will Glasgow have been out of the EU by that time already?
[LanX]: nope
hippo might venture to YAPC::EU.
[choroba]: YAPC::YAEC (yet another European country)
[LanX]: they are proposing an infinite transition phase now ...
[choroba]: infinite transition implies infinite money!
[LanX]: ... ehm ..."open ended" ;-)

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2018-02-23 10:53 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (301 votes). Check out past polls.