#! /usr/bin/perl -l use strict; use warnings; our @array = ( 1 .. 5 ); sub foo { our @array; print " inside before modification: @array"; # work with @array and modify it @array = ( 'a' .. 'e' ); print " inside after modification: @array"; } # now do the work print "outside before calling foo(): @array"; foo(); print "outside after calling foo(): @array";