On Thu, 8 Nov 2001, Wagner Garcia Campagner wrote:
> I don't know how to tell perl EOF, i am doing a search in a file like this:
You don't need to -- you can loop through a file and it will stop
automatically when EOF is reached.
>
> $username eq 'wagner';
> $file = 'c:\file';
>
> open(INFO, $file);
You should make sure you handle the condition that the file can't be
opened:
open(INFO, $file) or die "Could not open $file:\n";
> do
> {
> $lines = <INFO>;
> chop $lines;
> }
This is not the way to do it. This will work:
while(<INFO>) {
last if /$username/;
}
close(INFO);
-- Brett
http://www.chapelperilous.net/
------------------------------------------------------------------------
Ambidextrous, adj.:
Able to pick with equal skill a right-hand pocket or a left.
-- Ambrose Bierce, "The Devil's Dictionary"
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]