Hi...
I have a code like this:
Code:
open (INPUT,"<file"){
while (<INPUT>){.
.
.
}
if ($_=~/(?:(Error|exception))/){
$error=$1;
save_error($error);
}
if ($_=~ /somthinelse/) {.
.
.
sub save_error($error){
open(ERRINP,">Err.txt") #open another file and save the error to that file
print ERRINP $error
close ERRINP;
open(ERRINP,"<Err.txt") # open the error log file
whlie (<ERRINP>){ # for checking some other condition in error file
if $_=~/..../ {
do_some_thing
}
pro .
.
}
opening another file while we have an open file will replace $_ and this cause problem for the second if becuase now $_ has been changed,
is there any way that I can push $_ and other file pointers and pop them after calling a function?
Thanks in advance..