>Hi everybody,

>I've done a dummy test, and finalized that David's method is the
>Goal Method, that's really Really Very Great !!!

>I've made a 50MB Text file ( Fixed length, 1001 char per line, with \n)
>for this test, and have the following results :

>#### SCRIPT 1 ##### Suggested by Johnson
>$start = time;
>open (FH, "text.txt");
>while (<FH>) { $data = $_ }
>close (FH);
>$end = time - $start;
>print $end."\n";
>###### END WITH 8 SECs #######

>##### SCRIPT 2 #### Suggested by myself
>$start = time;
>open (FH, "text.txt");
>@FD = <FH>;
>close (FH);
>$data = $FD[$#FD];
>$end = time - $start;
>print $end."\n";
>###### END WITH 8 SECs #######

>##### SCRIPT 3 #####  Suggested by David ( I've completing it =))
>$start = time;
>open (FH, "text.txt");
>seek (FH,0,2); ## I use 0 here as I assume the last line is not /^\n$/
>$curpos = tell(FH);
>while (! $PrevEOL)
>{   $data = <FH>;
 >    if ($data !~ /\n$/) { $curpos -- ; seek (FH, $curpos, 0);  }
 >    else { $PrevEOL = 1 }
>}
>$data = <FH>; close (FH);
>$end = time - $start;
>print $end."\n";
>###### END WITH 0 SEC ( Actually 0.0x Sec) #######

>Please don't alarm me for omitted to use my , strict and -wT here,
>I will use them for doing my own script =)

>Besides, even though the time consume for Johnson's one and mine
>one are the same (nearly), however, it's better for try Johnson's one.
>That's beacuse if there are 5 or more clients query this File at the same
>time, mine one will surely halt the system (WinMe).

>Wish you have a nice day,
>Smiley Connie =)

Connie..try this and pls see the time diff..this has been taken from Perl Cookbook 8.10

##### SCRIPT 4 #####  >$start = time;
open (FH, "text.txt");
while (<FH>) {
   $addr = tell(FH) unless eof(FH);
}

$lastline = seek (FH, $addr,0);
print $end."\n";
###### END WITH 0 SEC ( Actually 0.0x Sec) #######

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to