in reply to How can I stop relying on a global variable?
You've said what you don't want to do; what is it you do want to do? I mean, I could just say "delete the code where you're checking the global variable", but I suspect wouldn't be acceptable. It would probably help if you show some sample code illustrating the current situation, how the variable is being altered and being checked.
Perhaps one possibility is to pass the relevant hash members into the function as parameters. So that, if you code currently looks like
you could change it tofunction(); sub function { print $hash{'status'}; }
function( $hash{'status'} ); sub function { my( $status ) = @_; print $status; }
|
|---|