fit_data(\@array); sub fit_data { my $refCopy=$_[0]; *ydata=$refCopy; print "array contains: ",join(",",@ydata)," \n"; print "last index is $#ydata \n"; } #### use strict; my @valueArr = (1,2,3,4); fit_data(\@valueArr); fit_dataLex(\@valueArr); fit_dataGlobal(\@valueArr); sub fit_data { no strict "vars"; my $refCopy=$_[0]; *ydata=$refCopy; print "array contains: ",join(",",@ydata)," \n"; print "last index is $#ydata \n"; #but you can't use strict on @ydata references } #if we define @ydata with my, it's not in the glob table, but strict is happy. sub fit_dataLex { use strict; my @ydata; my $refCopy=$_[0]; *ydata=$refCopy; #but @ydata not set print "array contains: ",join(",",@ydata)," \n"; print "last index is $#ydata \n"; } # if we create @ydata as global, we have to qualify it every time, # and dirty our global space with 'local' vars. @main::ydata = (); #to use a typeglob below, sub fit_dataGlobal { use strict; my $refCopy=$_[0]; *ydata=$refCopy; print "array contains: ",join(",",@main::ydata)," \n"; print "last index is $#main::ydata \n";}