Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

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

by glycine (Sexton)
on Jul 01, 2021 at 08:57 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-24 19:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found