# open CSV file open(FH,"myfile.csv") or die $!; # Loop through file content while (my $line = ) { # split each line so ( $data[0] == first col , $data[1] == seconds col ... so on ) my @data = split(/,/$line); # now you can test if something matched or not if ( ... ) { # Do Something here # if you want to end the loop after the first match , we just use last : last; } } # close File handle close(FH);