#! /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"; #### outside before calling foo(): 1 2 3 4 5 inside before modification: 1 2 3 4 5 inside after modification: a b c d e outside after calling foo(): a b c d e