Christian Calónico wrote: > 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?
Just keep reading. If the last block is shorter than 512, $block will just be shorter. You'll get a third trip through the loop for that 100 byte block. The next read after that will hit the EOF and the loop will exit. > 2) Is there any way to change dinamically $/ ? (i.e., to read > different number of bytes in each iteration) You don't need to. It'll just work. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]