SPUG: hashes, arrays, map, join

John Cokos jcokos at iwebsys.com
Fri Mar 9 23:07:19 CST 2001


To summarize .....

It seems that these are the options presented by you all:

Alternatives to the use of map in populating the has to start with:
    %ids = split /[,:]/, $results;
    %ids = $results =~ /(?:^|,)(\d+):(\d+)(?=,|$)/g;

To recreate the hash afterwards:
    These appear the same, but just for grins, I'll try them separately.
    join (',', map {"$_:$ids{$_}"} keys %ids);
    join ',', map "$_:$ids{$_}", keys %ids;

    ** Thanks for these ... this was the focus of my mental block to day
        Looking at it here, I can't believe I didn't "get it" earlier, I
tried,literally
        every combination of things but THIS one **


Anyway, I'm loading the DMOZ Data right now, into mySQL, so I'll have
a good 30 to 40 million indexed words to monkey with.  I'll report back
some time trials on each of these methods.

John



----- Original Message -----
From: Andrew Sweger <andy at n2h2.com>
To: Alex Leites <Alex.Leites at esca.com>
Cc: John Cokos, CEO, iWeb, Inc. <jcokos at iwebsys.com>; <spug-list at pm.org>
Sent: Friday, March 09, 2001 5:38 PM
Subject: RE: SPUG: hashes, arrays, map, join


> %ids = $results =~ /(?:^|,)(\d+):(\d+)(?=,|$)/g;
>
> is more evil. :)
>
> On Mar 9, 2001 @ 5:31pm, Alex Leites wrote:
>
> > One more thing:
> >
> > %ids = split /[,:]/, $results;
> >
> > is probably more efficient.
>
> --
>  Andrew B. Sweger <andy at n2h2.com> |  N2H2, Incorporated
>  Manager, ICE Development Dept    |  900 Fourth Avenue, Suite 3400
>  Content Management Division      |  Seattle WA 98164-1059
>  v=206.336.2947  f=206.493.0906   |  http://www.n2h2.com/
>
>
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>      POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
>       Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
>   Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
>  For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
>   Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
>
>


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list