On Dec 16, I.J. said: >Well, I am landing from C and this is all so intriguing, but at this time >I'd like to load part of the file(binary) as array of chars. Like: > read(FILE,$s,$I,$J); > @s=split//, $s; >however, It seems to me that much computer power are used in vain. Is there >any other way that does the job directly without string variable $s?
You could read a selected amount and split it: # read 8 bytes starting at the 100th byte $pos = 100; $len = 8; open FILE, "< $file" or die "can't read $file: $!"; seek FILE, $pos, 0; # where you want to start reading { local $/ = \$len; # number of bytes you want to read @chars = split //, <FILE>; } close FILE; Ta da. The magic of $/ (as documented in perlvar). -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]