The "while(<DATOS>)" is pulling a line, as well as the "$registro =
<DATOS>".
while (<DATOS>) { # reads a line into $_
$registro = <DATOS>; # reads a SECOND line
}
My guess is that the while() is reading the last line of the file, leaving
nothing for $registro.
Use this instead (although there is probably a more efficient way)...
while ($registro = <DATOS>) {}
Rob
-----Original Message-----
From: Ram�n Ch�vez [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 07, 2003 11:52 AM
To: [EMAIL PROTECTED]
Subject: RE: Reading Plain Text File - help
Sorry.
Last message had an error.
----------------------------------
I'm trying to read the last line on a Plain text File.
But when I use:
open (DATOS, "$bd") || die "Error: no se puede abrir el archivo";
while
ATOS>){
$registro = <DATOS>;
}
I don't get any value on $registro
I need to insert ---- $inicio = <DATOS>; ------
This way to get the the last line of my file in $registro:
open (DATOS, "$bd") || die "Error: no se puede abrir el archivo";
$inicio = <DATOS>;
while (<DATOS>){
$registro = <DATOS>;
It sounds weird for me. But maybe I'm missing something. I mean, the script
works at last, but I'd like better to have one line of code less.
Can anyone help me????
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]