Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PERL

perl exit loop example

my $counter = 1;
foreach $foo (sort {$importHash{$b} <=> $importHash{$a}} (keys %importHash))
{
  # push the string $foo onto the @tags array
  push @tags, $foo;
  
  # break out of our perl loop when the counter reaches 10
  last if ($counter++ == 10);
}
Source by alvinalexander.com #
 
PREVIOUS NEXT
Tagged: #perl #exit #loop
ADD COMMENT
Topic
Name
4+1 =