in reply to Re: RFC: Destructuring Assignment (aka Unpacking aka Type Patterns) in pure Perl
in thread RFC: Destructuring Assignment (aka Unpacking aka Type Patterns) in pure Perl
That's kind of a hash slice but in a DRY way to avoid typing and typos???
my ($foo, $bar) = @arg_map{qw/foo bar/} ?
Sure I can, but I'd need another command and would have a dependency to PadWalker. (Probably)
Something like set_key(my($foo, $bar)) would just return° the needed pairs from the solution in the OP
°) That is the equivalent to { foo => set my $foo , bar => set my $bar }
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: RFC: Destructuring Assignment (aka Unpacking aka Type Patterns) in pure Perl
by Fletch (Bishop) on Jul 04, 2020 at 03:52 UTC | |
by LanX (Saint) on Jul 04, 2020 at 10:35 UTC |