#!/usr/bin/perl @z = square(1,2,3,4); print "The squares are: @z\n"; sub square { $i = 0; foreach $element(@_) { # note that we never declared @z or said how big $z[$i] = $element * $element; $i++; } return(@z); } # Prints: # The squares are: 1 4 9 16