Hi gurus,
I want to read the STDIN as an input and I process the input whose
output can be single field or multiple fileds which I want to store in
variables. Based on that condition I want to perform two things, may be using
sub-routines. Inside the sub-routine, if I try to refer to the variables, which
are declared earlier (outside the sub routine), it is not working, obviously.
Is there a way to declare a global variable so that I can refer to that variable
inside a if loop or a sub-routine. I am sure there is a way.
snippet of the code
$input = <STDIN> ;
# I process the input here
# If the output from previous step is a single field, then call subroutine
"test" or call sub routine "test1".
sub test {
# I would like to refer to the $input variable and variables declared in the
main part
}
sub test1 {
}
I would appreciate any help. Thanks in advance.
Thx
Kailash
PS: I am a newbie.