Donnerstag, 20.12.2007, 05:57:34 Uhr
until in Perl
The until -command repeats a block, until a expression is true.
A simple example:
This little example prints the numbers 0-9.
The use of next , last and redo is possible.
Is the expression of until true, before the first loop begins, the code-block will not be processed.
If you want, that the code-block is processed at least once, you can use the form do{} until ();
This example prints the 10, althoug $i is 10 from beginning. The loop is processed one time .
Be careful, until can become a endless loop very easy, in case the expression in (..) is never true.
Until is the part of while , which processes a code-block, as long as the expression is true.
Thema: Sonstiges Perl
Der Beitrag "The until-command in Perl" wurde 2628 mal gelesen.
Zufällige Beiträge im /blog/perl
0.0289289951324463 sec. to build ...Blogsoftware in pure Perl - Powered by a lot of Coffee...
Von: perluser
Kommentar: Bei
foreach (@a){$_=~ s/\n//;}
Zum Beitrag
Von: Susi
Kommentar: vielen Dank, hat mir sehr geholfen :-)
Zum Beitrag
Von: TBu
Kommentar: Hi,
super Beispiel, DANKE!
Zum Beitrag
Von: Thomas Ha
Kommentar: Danke für den schönen Blog, er dient mir öfters mal als Nachschlagewerk!
Zum Beitrag
Von: Kasi
Kommentar: auch im november 2011 noch super hilfreich,danke dir gruß
Zum Beitrag
Gelesene Beiträge insgesamt: 2969224
Mo
Di
Mi
Do
Fr
Sa
So
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29