in reply to Using 'keys' on a list
keys doesn't operate on a list, it operates on a hash (or an array since 5.12).
You can create a hash, populate it with the list, and get its keys:
my %h = f(); say for keys %h;
You can also just return every second element of the list:
my $i; say for grep ++$i % 2, f();
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Using 'keys' on a list
by Corion (Patriarch) on Jun 29, 2021 at 12:48 UTC | |
by Anonymous Monk on Jun 29, 2021 at 22:09 UTC | |
by Corion (Patriarch) on Jun 30, 2021 at 05:55 UTC | |
Re^2: Using 'keys' on a list
by lammey (Novice) on Jun 29, 2021 at 14:55 UTC | |
by choroba (Cardinal) on Jun 29, 2021 at 15:13 UTC | |
by lammey (Novice) on Jun 29, 2021 at 17:02 UTC | |
by LanX (Saint) on Jun 29, 2021 at 19:29 UTC | |
by Anonymous Monk on Jun 29, 2021 at 22:09 UTC |
In Section
Seekers of Perl Wisdom