<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face="Courier New" size=2>1) Just a little hint, obvious though this
may be to many.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>-i can be used without -p.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>perldoc perlrun gives info on using -pi,
but not on -i by itself. </FONT><FONT face="Courier New" size=2>The usage is
easy; just add the while and print yourself.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>To remove all filenames containing
/Temporary Internet Files/ from a list of filenames I saved in
~/allfiles:</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>$ perl -i -e 'while(<>){print unless
/Temporary Internet Files/}' ~/allfiles ; wc allfiles
allfiles.bak<BR> 283986 498823 17066061 allfiles<BR> 382211
1087456 28422428 allfiles.bak</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>So when I last generated that list (with
find / > ~/allfiles ), I had over half a million Temporary Internet Files.
Phew.. maybe I read too much.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>2) </FONT><FONT face="Courier New"
size=2>List::SkipList</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT><FONT face="Courier New"
size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>If anyone wants to know a fast &
efficient sorting module, you might try List::SkipList. It's a way of creating a
sorted list in memory. I can generate a million-element list in RAM in about a
minute on my Athlon 2400 XP laptop, under ActiveState Perl, with List::SkipList
0.70. That's about 15 times slower than GNU sort, which is still often the best
way to sort large lists, and perhaps no more efficient than the sort built into
Perl, but the ability to maintain a list in sorted order as you insert elements
is sometimes desirable. (You might also do just as well with BerkeleyDB,
however, since it's fast efficient C code, and since disk writes can be cached
quite well for a small database...)</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>If you'd like to test for yourself, you can
use the following program.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>I put a long comment in there at a place I
had a problem on Cygwin Perl 5.8.2 64-bit ints, in case anyone else has the
problem. Works fine on ActiveState 5.8.2, or Cygwin 5.8.4 32-bit ints I compiled
recently.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>#!perl -w<BR>$|=1;<BR>use strict;<BR>use
Time::HiRes qw(time);<BR>use List::SkipList;<BR>#$list->insert( 'key1',
'value' );<BR>#$list->insert( 'key2', 'another value' );<BR>#$value =
$list->find('key2');<BR>#$list->delete('key1');<BR>my $n =
1000.0/64;<BR>#print "If the algorithm is of complexity O(n**1.5) then factor
should be about 8 (4**1.5)\n";<BR>my $last = 0;<BR>my $factor = 0;<BR>my
$list;<BR>my $svptr = 0;<BR>my @svarray;<BR>while ($n <=
1024001.0)<BR>{<BR># print "deallocating list..";</FONT></DIV>
<DIV><FONT face="Courier New" size=2># The following line caused perl to
silently bomb-out </FONT></DIV>
<DIV><FONT face="Courier New" size=2># for me without the push @svarray
</FONT></DIV>
<DIV><FONT face="Courier New" size=2># in Cygwin Perl 5.8.2 64-bit using
AutoLoader 5.60</FONT></DIV>
<DIV><FONT face="Courier New" size=2># after a list of 4061 elements or more has
been created,</FONT></DIV>
<DIV><FONT face="Courier New" size=2># and is apparently being deallocated,
whether running</FONT></DIV>
<DIV><FONT face="Courier New" size=2># List::SkipList 0.64, 0.65, or
0.70.</FONT></DIV>
<DIV><FONT face="Courier New" size=2># It may be something wrong with my Perl
installation.</FONT></DIV>
<DIV><FONT face="Courier New" size=2># A debugger trace showed the program ended
after a line with this statement,</FONT></DIV>
<DIV><FONT face="Courier New" size=2># in line 96 of an unknown module,
which exists in line 96 of AutoLoader:</FONT></DIV>
<DIV><FONT face="Courier New" size=2># <FONT face="Times New Roman" size=3>*$sub
= sub {}; </FONT></FONT></DIV>
<DIV><FONT face="Courier New" size=2># But it works fine with Cygwin
Perl 5.8.4 (compiled myself, 32-bit ints) </FONT></DIV>
<DIV><FONT face="Courier New" size=2># or ActiveState 5.8.2,</FONT><FONT
face="Courier New" size=2> with exactly the same AutoLoader, according to diff
-b<BR> $list = 0; <BR># print "creating
list..";<BR> $list = new List::SkipList( max_level => 8
);<BR># push @svarray, $list; </FONT><FONT face="Courier New"
size=2># <BR> my @a = ();<BR> for
(0..$n) {$a[$_] = sprintf("%d",rand()*1e11)};<BR> my $t0 =
time;<BR> for (0..$n)
{$list->insert($a[$_],1)};<BR> my $tend =
time;<BR> my $elapsed = $tend - $t0;<BR>
$factor = $elapsed / $last if $last;<BR> printf "n=%6d
elapsed:%7.3f, factor=%5.2f\n", <BR> $n, $elapsed,
$factor;<BR> $n *= 4.0;<BR> $last =
$elapsed;<BR>};<BR>print "n=$n\n";<BR></DIV></FONT></BODY></HTML>