Re: [PBML] Answer ? Seek ???
- To: <email@example.com>, <firstname.lastname@example.org>
From: "Gordon Stewart" <Gordon.Stewart@...>
Date sent: Mon, 03 Sep 2001 12:39:31 +1200
Send reply to: email@example.com
Subject: [PBML] Answer ? Seek ???
> I think ive found it (will try it later - at home - 8-9 hours time)No. It should be
> read FILEHANDLE,SCALAR,LENGTH,OFFSET
> (For this example, query, Changed it to read 150 characters)
> I can do
> $store = read (INF, 50,150,0) ;
> Starting with SCALAR of 50 (starting poiint), - Reading another 150
> characters, and offset of 0
seek INF, 50, 0
read INF, $store, 150, 0;
if you wanted to skip the first 50 characters and read the next 150.
> Q. What does the OFFSET do ?The offset specifies where IN THE $store VARIABLE should the
data be read to. This way if you for example have a buffer that
contains some data and you want to read the next chunk you may
do this :
read INF, $buff, 1024, length($buff);
This way the data you read are appended to the end of $buff.
The return value of read() is the number of characters read. This
way if you get less characters than you asked for you know that
there is nothing left in the filehandle (at least for now, if it is a
socket or pipe you may get some more data later)
== Jenda@... == http://Jenda.Krynicky.cz ==
: What do people think?
What, do people think? :-)
-- Larry Wall in <199808071736.KAA12738@...>
- --- Jenda Krynicky <Jenda@...> wrote:
> No. It should be<
> seek INF, 50, 0
> read INF, $store, 150, 0;
> if you wanted to skip the first 50 characters and
> read the next 150.
> > Q. What does the OFFSET do ?
Thanks.. - Ive already done it, at after-noon tea-time
at work (I sent the script i used - to the group).
Basically, my file is over 180 megabytes..
& (before) - Using a for-each loop - On my own
Pc/Server , it took 4-6 minutes to loop through the
The routine i sent to the group, did it in 1/4 - 1/2 a
(I think thats a big improvement)
New Zealand chat & Discussion group email
firstname.lastname@example.org for details.
http://travel.yahoo.com.au - Yahoo! Travel
- Got Itchy feet? Get inspired!