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

RE: Flipper

by gregorovius (Friar)
on May 21, 2000 at 05:18 UTC ( #13957=note: print w/replies, xml ) Need Help??


in reply to Flipper

You can use Tie::FlipFlop for the same purpose. Here's the synopsis from the perldoc document:
use Tie::FlipFlop; tie my $flipflop => Tie::FlipFlop => qw /Red Green/; print $flipflop; # Prints 'Red'. print $flipflop; # Prints 'Green'. print $flipflop; # Prints 'Red'.
It's probably too much for such a simple function but frees you from keeping the $flip variable around.

You can use Tie::Counter in the same fashion to rotate through more than two elements.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2022-08-16 10:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?