in reply to if else condition not assigning value when using my

'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.

  • Comment on Re: if else condition not assigning value when using my