hi all,
I have a problem with the following structure:
while(<file>){$thevariable=$1 if (/variable1=(.*)/)};
Now I wanna be sure that variable1 was really set in the above
statement (it could have an old value from a previous embracing loop).
Then I tried:
while(<file>){if (/variable1=(.*)/)
{$thevariable=$1} else {$thevariable="nonset"};
The problem is, the second while statement is resetting $thevariable
for every line in the file and not only for the matching one. The
else {$thevariable="notset"} option should be actually only run if
we reach the end without matching. But both while structures above
aren't solving my problem.
Thanx in advance for any help!
Thread Next