Hi all,

Sorry about subject line, it's the best I could do. Two (somewhat realted)
questions...

I have several types of user input values I am storing in %history, similar
to the way the shell maintains a history of previous command line commands.
These are only used by a sub-routine, but they need to remain valid for the
life of the program. I see no reason for them to be global, but if they
live in a subroutine, they will be initialized each time. 

My current solution is to place the %history variable and its sub-routine
inside a block. 

A second (related?) problem. I have a variable $READ_ONLY that is needed by
some routines. Right now this is also a global value which has a default
value, but then is modified by one sub-routine. I see no reason for this to
be global, either.

I'm thinking that it would be better to set up a sub-routine called
"file_mode" and use it like an OO-method getter/setter. You call it with a
value (file_mode("r") and it sets this value. You call it without any
parameters and it returns the current value. 

Is this a valid alternative to global variables?

-K

-- 
Kevin Pfeiffer
International University Bremen


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to