Functions (sub)
Subroutines with sub; arguments are in the @_ array, return with return.
Simple enough for a 5-year-old to understand
sub and @_
Arguments arrive in the @_ array: $_[0] is the first, $_[1] is the second.
sub square { my ($x) = @_; return $x * $x;}print square(5), "\n";🎯 Exercise & Practice
Test what you've learned — answer, write code, check instantly. (1 left)
🎯 Expected output: 17