K
Krishna Chaitanya
In Perl, is the order of evaluating subroutine args L-to-R?
I saw in perlop that a comma operator in a list context evaluates from
L-to-R, and also in perlsub that all args to a subroutine are squashed
into 1 single list......can I deduce from these 2 statements that
order of evaluation of subroutine args is L-to-R as well?
I wrote some sample code like this, and would like to predict its
outcome (if possible):
====================
#!/usr/bin/perl
sub func { }
my $a = sub { print "Hello"; };
my $b = sub { print " world "; };
func($a->(),$b->());
====================
TIA,
Chaitanya
I saw in perlop that a comma operator in a list context evaluates from
L-to-R, and also in perlsub that all args to a subroutine are squashed
into 1 single list......can I deduce from these 2 statements that
order of evaluation of subroutine args is L-to-R as well?
I wrote some sample code like this, and would like to predict its
outcome (if possible):
====================
#!/usr/bin/perl
sub func { }
my $a = sub { print "Hello"; };
my $b = sub { print " world "; };
func($a->(),$b->());
====================
TIA,
Chaitanya