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

Re^3: Flip-flop won't DWIM

by akho (Hermit)
on May 21, 2009 at 16:15 UTC ( #765494=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Flip-flop won't DWIM
in thread Flip-flop won't DWIM

Your code prints "A B C D E F" for me, and I cannot see why it would print anything else.

This seems to work if you insist on using flip-flop:

$x = 1; print join " ", grep { $x..(($x=0) or /D/) } qw(A B C D E F);
However, you could copy stuff from List::MoreUtils.


Comment on Re^3: Flip-flop won't DWIM
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2015-08-04 05:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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













    Results (59 votes), past polls