use strict;
use warnings;
use feature 'say';
sub f {a => 1, b=>2}
my $foo = f();
my $bar = join '_', f();
say $foo;
say $bar;
#outputs
2
a_1_b_2
####
sub f {a => 1, b=>2}
my @all_key = keys f();
##
##
sub f {a => 1, b=>2}
my %h = (c => 3);
say keys %h, f();
#output:
c
##
##
sub f {a => 1, b=>2}
my %h = (c => 3);
say keys f(), %h;
#warnings:
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.
##
##
use strict;
use warnings;
use feature 'say';
sub f {a => 1, b=>2}
my $foo = f();
my $bar = join '_', f();
say $foo;
say $bar;
#output
2
a_1_b_2
sub f {a => 1, b=>2}
my @all_key = keys f();
#warnings:
Experimental keys on scalar is now forbidden at call_art.pl line 7.
Type of arg 1 to keys must be hash or array (not subroutine entry) at call_art.pl line 7, near ");"
Execution of call_art.pl aborted due to compilation errors.
sub f {a => 1, b=>2}
my %h = (c => 3);
say keys %h, f();
#output
ca1b2
sub f {a => 1, b=>2}
my %h = (c => 3);
say keys f(), %h;
#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.