in reply to Re: Comma separated list into a hash
in thread Comma separated list into a hash

I'd think you could do
keys split
And a bunch of (missing :) ) punctuation..

Replies are listed 'Best First'.
Re: Re: Re: Comma separated list into a hash
by gsiems (Deacon) on Apr 26, 2004 at 03:59 UTC
    Now you've done it. You do realize that I now feel compelled to figure out how this is done. :^)
      Actually I was being overly clever and I forgot a map keyword. Whoops =/.

      Corrected: print keys map split;

      Just add three '}', three '{', one % sign and stir. =]

        I figured there had to be a map/grep in there somewhere. Being a "Bear of Very Little Brain", map (and to a lesser extent grep) still throw me.

        You'd be thinking something like:

        $s = 'hi, there, world, how, are you, today?'; print join "\n", keys %{{ map {$_ => undef} (split /,\s+/, $s)}};

        And no, I didn't figure that one out by myself :-(

        Although, I rather prefer:

        $s = 'hi, there, world, how, are you, today?'; print (join "\n", (grep ! $t{$_}++, (split /,\s+/, $s)));

        BTW. Thanks for the puzzle ;^)