I ended up doing this:
open(DATAFILE,"file.txt") or die "\nCouldn\'t open $datafile\n";
@datafile = ('0');
$position = 1;
while(<DATAFILE>){
chomp($_);
$datafile[$position] = $_;
$position++;
}
and then calling the lines as I needed them using $datafile[4] where 4 IS
the line number (not line 5).
> From: [EMAIL PROTECTED] (Walter Valenti)
> Newsgroups: perl.beginners
> Date: Wed, 24 Oct 2001 15:03:20 +0200
> To: Shannon Murdoch <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: Text file line input referencing
>
> I think thath be very simply use a counter.
>
> Walter
>
>> Hi all,
>>
>> I am wondering if there is any way that I can take the contents of a
>> specific text file line number (I suppose it could be called a paragraph,
>> since a line is considered ended by a CR/LF and may contain multiple
>> sentences) and put them in to a variable for manipulation.
>>
>> I've been using the while(<FILEHANDLE>){ command, but it's not very helpful
>> when I need something on line #15 or something.
>>
>> Is there any function like $linecontents = line(FILEHANDLE,15); ?
>>
>> Thanks in advance!
>> -Shannon
>>
>> --
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]