'my' variables are local to any block they are in. In your case I count 4 blocks with as many DIFFERENT variables $rec_type that vanish as soon as the 'if' or 'elsif' block (the code lines inside {}) is finished executing
put a line "my $rec_type; my $y_label;" before the "if" and remove any 'my's inside the if and elsif cases.
In reply to Re: if else condition not assigning value when using my
by jethro
in thread if else condition not assigning value when using my
by rakheek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |