in reply to Re^2: Extract a small part of a long sentence using regular expressions
in thread Extract a small part of a long sentence using regular expressions

It's a dereference, I'd rather (if ever) write it as
my %hash = map { $key++ => $_ } grep { $_ != 0 } sub { $line =~ /action\(([^)]+)\)/; split /,/, $1; }->();
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
  • Comment on Re^3: Extract a small part of a long sentence using regular expressions
  • Download Code

Replies are listed 'Best First'.
Re^4: Extract a small part of a long sentence using regular expressions
by karlgoethebier (Abbot) on Dec 02, 2014 at 17:19 UTC
    "It's a dereference..."

    Thank you for answering this question for me.

    But i'm Karl and you are Choroba, isn't it?

    "...(if ever)..write it"

    May be - if you make so. But there is nothing wrong with the syntax i used to dereference a anonymous sub.

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

      No offence. I use anonymous subs sometimes, too. I just don't feel it's needed here:
      my %hash = map { $key++ => $_ } grep { $_ != 0 } map { split /,/ } $line =~ /action \( ( [^)]+ ) \) /gx;
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

        Thank you. It seems like that was the missing idiom :-)

        Best regards, Karl

        «The Crux of the Biscuit is the Apostrophe»

Re^4: Extract a small part of a long sentence using regular expressions
by Anonymous Monk on Dec 02, 2014 at 16:07 UTC
    Got it!! Cheers!