Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^9: Using 'keys' on a list (update x2)

by glycine (Sexton)
on Jul 01, 2021 at 08:57 UTC ( #11134530=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    #outputs
    2
    a_1_b_2
    
  2. or download this
    sub f {a => 1, b=>2}
    my @all_key = keys f();
    
  3. or download this
    sub f {a => 1, b=>2}
    my %h = (c => 3);
    say keys %h, f();
    #output:
    c
    
  4. or download this
    sub f {a => 1, b=>2}
    my %h = (c => 3);
    ...
    Experimental keys on scalar is now forbidden at perl.pl line 11.
    Type of arg 1 to keys must be hash or array (not subroutine entry) at 
    +perl.pl line 11, near "),"
    Execution of perl.pl aborted due to compilation errors.
    
  5. or download this
    use strict;
    use warnings;
    ...
    Experimental keys on scalar is now forbidden at call_art.pl line 8.
    Type of arg 1 to keys must be hash or array (not subroutine entry) at 
    +call_art.pl line 8, near "),"
    Execution of call_art.pl aborted due to compilation errors.
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11134530]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2022-05-20 04:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (72 votes). Check out past polls.

    Notices?