in reply to Re: map and grep one-liner problem
in thread map and grep one-liner problem

This is really getting close to unreadability :)
There is one thing in the first printf that I don't understand:  index $_, $key . ' '
What exactly does the last part do ( . ' ' ), adding a space ? why ?

LuCa

Replies are listed 'Best First'.
Re^3: map and grep one-liner problem
by Not_a_Number (Prior) on Mar 14, 2007 at 14:38 UTC
    What exactly does the last part do ( . ' ' ), adding a space ?

    Yes, that's exactly what it does. Otherwise, as johngg points out above, a search for 'b' will match not just 'b', but also, for example, 'bbking'. And if you look closely at this line in Anno's solution:

    my @values = map / (.*)/, grep /^$key /, @ta;

    you'll see that he does the same thing (note the space after ^$key ?)

      I see! Your one-liners confused me, they are hard to read :)

      Thnx a lot!
      LuCa