in reply to Re^2: nodelocked vs floating
in thread nodelocked vs floating

G'day vkknava,

Just to expand on tybalt89's reply, the ->%* (along with ->$*, ->@*, etc.) is a newer feature called "Postfix Dereference Syntax".

If you're using Perl version

See the doco link for more complete details. Also look at the following section, "Postfix Reference Slicing", which provides similar syntax for array and hash slices.

Although it did take a little while to get used to, I do find this new syntax greatly improves code readability. If you have an appropriate Perl version, I recommend you try it.

— Ken

Replies are listed 'Best First'.
Re^4: nodelocked vs floating
by vkknava (Novice) on Nov 23, 2018 at 16:43 UTC

    Thanks Ken. I have changed it like this and its working. I am using strawberry version.

      for my $license (sort grep /^Node/, keys %{$hash{$product}})
      "Thanks Ken."

      You're welcome.

      "I am using strawberry version."

      Strawberry provides many versions of Perl. It's the version of Perl that was important here. You can find that with the "perl -v" command.

      As an example, you can see that I'm currently using version 5.28:

      $ perl -v This is perl 5, version 28, subversion 0 (v5.28.0) built for darwin-th +read-multi-2level ...

      Which means I can write:

      $ perl -E 'my $href = { key => 42 }; my %h = $href->%*; say $h{key}' 42

      — Ken

        G'day Ken,

        Can you please share for the genuinely curious what you find advantageous about writing:

        my %h = $href->%*;
        vs. either of
        my %h = %$href; my %h = %{$href};
        both of which are shorter and show the eye with the first character, rather than the penultimate, what the product is going to be?


        The way forward always starts with a minimal test.