How do I break out of a loop in Perl?

前端 未结 5 1035
遥遥无期
遥遥无期 2020-12-02 04:59

I\'m trying to use a break statement in a for loop, but since I\'m also using strict subs in my Perl code, I\'m getting an error saying:

5条回答
  •  臣服心动
    2020-12-02 05:56

    Additional data (in case you have more questions):

    FOO: {
           for my $i ( @listone ){
              for my $j ( @listtwo ){
                     if ( cond( $i,$j ) ){
    
                        last FOO;  # --->
                                       # |
                     }                 # |
              }                        # |
           }                           # |
     } # <-------------------------------
    

提交回复
热议问题