in reply to Re^2: Perl ignore arrow object operator in search/replace (s/searchregex/replacestring/)
in thread Perl ignore arrow object operator in search/replace

The arrow operator works in strings for dereferencing hash and array elements, but not for calling coderefs, and not for method calls.

As well as the "@{[ ... ]}" trick, another option is "${\ ... }".

use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name
  • Comment on Re^3: Perl ignore arrow object operator in search/replace (s/searchregex/replacestring/)
  • Select or Download Code

Replies are listed 'Best First'.
Re^4: Perl ignore arrow object operator in search/replace (s/searchregex/replacestring/)
by LanX (Saint) on Feb 17, 2014 at 20:16 UTC
    I'm not sure where you are correcting me... Did I say anything different?

    But I normally avoid (recommending) the scalar deref trick cause it can only return scalars (sic ;) which can byte you heavily...

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      I'm not sure why you think I'm correcting you... I was agreeing with you. (And confirming the bit about coderefs, and adding method calls to the list.)

      use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name
        Cool, although none of that really applies to the OP :)