2009/11/29 raphael() <raphael.j...@gmail.com>: > 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?
perldoc -f last or http://perldoc.perl.org/functions/last.html HTH, Dp. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/