Help for this page

Select Code to Download


  1. or download this
    my $goal = 'over';
    my @array = qw(the quick fox jumped over the lazy dog);
    foreach my $item (@array) {
       next unless $item =~ /$goal/;
       print $item;
    }
    
  2. or download this
    my $goal = 'over';
    my @array = qw(the quick fox jumped over the lazy dog);
    for (@array) {
    ...
       print $_;
       last
    }
    
  3. or download this
    my $goal = 'over';
    my @array = qw(the quick fox jumped over the lazy dog);
    my $found_item;
    ...
       print $found_item;
       # do other stuff
    }
    
  4. or download this
    my $goal = 'over';
    my @array = qw(the quick fox jumped over the lazy dog);
    my $found;
    ...
          last;
       }
    }