Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have the following script segment:
This seemes always to fail ar the first pass and does not check the rest of the lines.open PAGE, "$data_reg" or die "Can't open $data_reg: $!"; while (my $line = <PAGE>) { ($username_db,$password_db,$email_address_db,$name_db,$spare) = sp +lit "\t",$line; if ($username eq $username_db) { $check++; } else { $problem = "Unfortunately we cannot find reference to the +username supplied.<br> Please check with the webmaster of this site."; print "$problem"; exit; } } close PAGE;
I can get round this by taking the 'else' statement out and doing (after close PAGE):
But I don't want to!if ($check){ #do something; } else { $problem etc. }
can someone tell me why the original fails to lookup the whole file?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: searching a file
by borisz (Canon) on Jan 14, 2004 at 16:53 UTC | |
Re: searching a file
by Fletch (Bishop) on Jan 14, 2004 at 16:52 UTC | |
Re: searching a file
by blue_cowdawg (Monsignor) on Jan 14, 2004 at 16:50 UTC | |
Re: searching a file
by naChoZ (Curate) on Jan 14, 2004 at 16:55 UTC | |
Re: searching a file
by Roy Johnson (Monsignor) on Jan 14, 2004 at 16:59 UTC | |
Re: searching a file
by jonadab (Parson) on Jan 14, 2004 at 18:52 UTC |
Back to
Seekers of Perl Wisdom