<?xml version="1.0" encoding="windows-1252"?>
<node id="153516" title="Re: Extreme Example of TMTOWTDI" created="2002-03-22 04:13:47" updated="2005-07-19 14:08:11">
<type id="11">
note</type>
<author id="3568">
ChOas</author>
<data>
<field name="doctext">
Hi!, &lt;BR&gt;
&lt;BR&gt;
Care to test this one aswell ? &lt;BR&gt;
&lt;BR&gt;
I had the following results (25143 words): &lt;BR&gt;
&lt;CODE&gt;
ChOas@xxx$ time ./yours words

real    0m1.21s
user    0m1.01s
sys     0m0.07s
ChOas@xxx$ time ./mine words

real    0m0.68s
user    0m0.54s
sys     0m0.05s
ChOas@xxx$ 
&lt;/CODE&gt;
&lt;BR&gt;
This is the code: &lt;CODE&gt;

#!/usr/bin/perl -w 

use strict;

my %Word;
my $File;

# Fill the hash/list here, ignoring the chomp

push @{$Word{length$_}},$_ while (&lt;&gt;);

# Itterate over the different lenghts of words

for (keys %Word)
{
# This is what is called a dirty hack, subtract 
# one from the length of the string to compensate 
# for the '\n' (but hey, it saves a chomp for every word :) )

 $File=$_-1 . ".mine";

# Write the file

 open OUT,"&gt;$File" or die "Cannot open $File.mine: $!\n";
 print OUT @{$Word{$_}};
 close OUT;
};
&lt;/CODE&gt;
&lt;BR&gt;
p.s. You REALLY want to run/develop code with use strict; and -w...&lt;BR&gt;
&lt;BR&gt;
GreetZ!,&lt;BR&gt;&lt;UL&gt;ChOas&lt;/UL&gt;
&lt;BR&gt;
&lt;FONT SIZE="1"&gt;print "profeth still\n" if /bird|devil/;&lt;/FONT&gt;</field>
<field name="root_node">
153514</field>
<field name="parent_node">
153514</field>
</data>
</node>
