# $formatThis is not known here sub A { # begin of subroutine # what is $OBJ ? is it a global variable? or is it passed into this sub? # what is $p ? is it a global variable? or is it passed into this sub? if ( exists $OBJ->{$p} ) { my $q = $OBJ->{$p}; $q = &$::formatThis($q); # wrong! means: # read one record from filehandle 'package_name' print FH "$p=$q "; } my $formatThis = sub { # $formatThis declared as my(), lexically scoped my $x = @_; # wrong! evaluates @_ in scalar context! my $y = sprintf ( "%.2f", $x); return $y; }; } # end of subroutine # from here on $formatThis is not known