title: exit while loop after find first match
body: <p>I need to exit the loop after find first match and go to another search in the loop</p>
  
  <pre><code>use strict;
  use warnings;
  
  my %iptv;
  sub trim($) {
      my $string = shift;
      $string =~ s/\r\n//g;   
      $string =~ s/^\s+//;    
      $string =~ s/\s+$//;    
      return $string;
  
  my @files=&lt;/tests/*&gt;;
  open IN, "/20131105.csv";
  LINE: while (&lt;IN&gt;) {
          chomp;
           my @result = split(/;/,$_);
           my $result1 = trim($_);
           $result[1] = trim($result[1]);
           $iptv{$result[1]} = $result1;
      }
  close IN;
  
  foreach my $file (@files) {
          open FILE, "$file";
          while (&lt;FILE&gt;) {
                  chomp;
                  my ($mac, $date) = split(/;/,$_);               
                  my @date1 = split(/\s/, $date);
                  print "$iptv{$mac};$date1[0]\n" if defined $iptv{$mac};
                  last LINE if (defined $iptv{$mac});
                  }
  close FILE;
  }
  </code></pre>
  
  <p>I tried to use "last" function but it finds first match and ends program. where I have to put last?</p>