3 ms·
You can avoid using temporary variables with the @{[...]} and ${\...} idioms: my $x = 1; say "$x + 1 = @{[ $x + 1 ]}"; sub plus1 { $_[0] + 1 } say
by draegtun 14y ago
You can avoid using temporary variables with the @{[...]} and ${\...} idioms:
my $x = 1;
say "$x + 1 = @{[ $x + 1 ]}";
sub plus1 { $_[0] + 1 }
say "$x + 1 = ${\plus1($x)}";