Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

RE: Flipper

by gregorovius (Friar)
on May 21, 2000 at 05:18 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-24 01:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found