The map always assigns an element to the argument list $_, and then evaluates the expression. Thus, it map mysqr($_), 1,2,3,4,5causes mysqr1,2,3,4,5 for each of the elements, because it is $_set in each of 1,2,3,4,5 in turn.
, $_ , , Perl, , $_ . , lc . mysqr , , , :
sub mysqr {
my $input;
if (@_) { ($input) = @_ }
else { $input = $_ }
my $answer = $input * $input;
return $answer;
}
map(mysqr, 1,2,3,4,5);