sub f1{ my ($a) =@_; $cp=1; $LOCAL_CODEPAGE =10; print "This is $a\n"; print $LOCAL_CODEPAGE; if ($a==1){ $LOCAL_CODEPAGE = $cp; break; } return $LOCAL_CODEPAGE = $a; print "\n"; } @3=(3,10, 13); ## comment this out and see your value come back as 9 print "\$LOCAL_CODEPAGE=$LOCAL_CODEPAGE: f1(@3,9,3,4,5): ".f1(@3,9,3,4,5)."\n";