0

perl的while循环及循环跳出


perl的while循环输出1-3

  1. #!/usr/bin/perl
  2. $a=1;
  3. while($a<=3){
  4.    print "$a\n";
  5.    $a++;
  6. }

输出控制,遇到2就跳过,输出1,3

  1. #!/usr/bin/perl
  2. $a = 1;
  3. while ($a<=3) {
  4.    if ($a==2){
  5.       next;
  6.    }
  7.    print "$a\n";
  8. }
  9. continue{
  10.    $a++;
  11. }

我猜~这些文章你可能也感兴趣

暂时没有留言..

给我留言:

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word