[EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:
> En op 08 april 2002 sprak Keith Calvert Ivey:
> > Can anyone explain why the first of these solutions works fine,
> > while this (changing for to map) blows up on the last test
> > (the big one), causing the memory usage to exceed 1 GB?
> >
> > #!perl
> > map$%{join _,sort/./g}.=$_,sort<>;$_[s/
> > ^/ /gm].=$_ for sort%%;print@_[1..$=]
> >
> > #!perl
> > map$%{join _,sort/./g}.=$_,sort<>;map$_[s/
> > ^/ /gm].=$_,sort%%;print@_[1..$=]
> >
> > I'm using ActiveState's Perl 5.6.1, build 626, so maybe it's a
> > Windows thing.
>
> Nope. I hit the same brick wall and tried it on Linux as well
> where it failed with 'out of memory'. I asked Dave to try it
> and it blew up for him too. I thought it was a Perl bug,
> but I was too fatigued and frustrated at the time for any
> sort of rational analysis.
I found this too when hunting for a < 64; however even if that
solution had worked on the big test case, it should probably be
rejected on the grounds that an anagram set could contain more than 60
words.