#!/usr/bin/env perl use utf8; use Utils; use strict; use warnings; MAIN: { my $NUM_SQUARES = 5; my $squares = []; # Put the squares into the list for (my $i = 0; $i < $NUM_SQUARES; ++$i) { push(@{$squares}, $i * $i); } # Print out the squares from the list for (my $i = 0; $i < scalar(@{$squares}); ++$i) { print Utils::messageFormat("\{0:d\}^2 = \{1:d\}", $i, $squares->[$i]), "\n"; } print Utils::listToString($squares), "\n"; }