#!/usr/local/bin/perl # new line at the end of each print, automatically $\ = "\n"; @x = (); for $num (1..10) { $num2 = $num*$num; push @x, $num2; print qq(added $num2, now last element is $x[-1]); }