I translated the Go example to Perl by making simple syntax transformations:
- Printing is done with
sayinstead offmt.Println. - Variables have a sigil that define their "type", for example,
$ainstead ofa. - Address of a variable is return with
\instead of&. - References/Pointers are dereferenced with
$instead of*. - Comments are made with
#instead of//. - Perl requires semicolons.
Here's the program: