From: Christian Calónico <[EMAIL PROTECTED]>
> 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)
You shouldn't fiddle with $/ unless you have to. It's too global. In
this case you want to use
read(IN, $block, 512)
instead of
$/ = \512;
$block = <IN>;
See
c:\> perldoc -f read
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]