How to stop exit an exicuting loop while it meets an inner condition?

We use last for exiting from an execution loop.

It’s as follows :

for(my $m=0;$m<=$country_tot;$m++) {
    if($country_id[$m]==$row_detail->{country}) {
         $cntry=$country_name[$m];
         last;
    }
}

Leave a Reply