Thread do {} until () anomalie? (18 answers)
Opened by lichtkind at 2005-01-20 04:04

Dubu
 2005-01-20 13:06
#50910 #50910
User since
2003-08-04
2145 Artikel
ModeratorIn + EditorIn

user image
format_c hat leider die interessantere Quelle dazu weggelassen:

[quote=perldoc perlsyn,Statement Modifiers]
[...] Note also that the loop control statements described later will NOT work in this construct, because modifiers don't take loop labels.  Sorry.  You can always put another block inside of it (for "next") or around it (for "last") to do that sort of thing.  For "next", just double the braces:
Code: (dl )
1
2
3
4
           do {{
              next if $x == $y;
              # do something here
          }} until $x++ > $z;

      For "last", you have to be more elaborate:
Code: (dl )
1
2
3
4
5
6
           LOOP: {
                  do {
                      last if $x = $y**2;
                      # do something here
                  } while $x++ <= $z;
          }

[/quote]

View full thread do {} until () anomalie?