develooper Front page | perl.beginners | Postings from March 2003

reading from file

Thread Next
From:
Christian Calónico
Date:
March 27, 2003 06:20
Subject:
reading from file
Message ID:
BAY1-F80us0PNqqH26f000515aa@hotmail.com

If I'm reading from a file (suppose that it haves 1124 bytes) in this way:

open IN, "data2.txt" or die $!;
$/ = \512;
while( my $block = <IN> )
{
...
}

1) Two iterations reads 1024 bytes. The third iteration is possible? How can 
I read the last 100 bytes?
2) Is there any way to change dinamically $/ ? (i.e., to read different 
number of bytes in each iteration)

Thanks in advance,
Christian




_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger: 
http://messenger.yupimsn.com/


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About