Hi, I want the below if loop to end if it cannot find any match & print the die message. However it just exit without hitting my "die"
As you can see in the code below I have tried many foolish ways to make the script say that it cannot find the number searched in while loop. while ( my $line = $FH->readline ) { chomp; next if ( $line =~ m/return/i ); if ( $line =~ m/^$number\s+(\S+)\s+(.*)$/ ) { &get_info($number, $1, $2); # if ( $1, $2 ); # <-- don't execute sub &get_info unless a match die "\nNo Entries Found By Number: [$number]\n" unless ($1); # print $1; exit; last; } } $FH->close(); Any Ideas?