Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Odd and even table rows

by Moron (Curate)
on Aug 09, 2007 at 09:54 UTC ( #631506=note: print w/ replies, xml ) Need Help??

in reply to Odd and even table rows

My first thought was:

our $flipflop = !1; our %class = ( $flipflop => 'even', !$flipflop => 'odd' ); sub getclass { $class{ $flipflop = !$flipflop }; }
The '!' in the initialisation values are to avoid reliance on specific truth values so they can be used safely as hash keys for any given Perl implementation.

update: in practice I'd use an instance variable instead of a class variable for $flipflop, but before that I'd have to do OO makeover of the OP which I avoided doing.


^M Free your mind!


Comment on Re: Odd and even table rows
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2015-08-30 05:12 GMT
Find Nodes?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...

    Results (346 votes), past polls