in reply to Loops and variable usage

I don't see any loop, but I do see a couple of things which most likely don't do what you intended.  Maybe retry with this:

sub ddd { my $a = $_[0]; my $b = $_[1]; my $c = $_[2]; # could also be written as: # my ($a, $b, $c) = @_; if ($a == 1) { $a = 'p'; } elsif ($a == 2) { $a = 'pp'; } if ($b == 3) { $b = 'w'} print " < $a > < $b > < $c >"; }

Replies are listed 'Best First'.
Re^2: Loops and variable usage
by Anonymous Monk on Mar 23, 2012 at 18:41 UTC
    Sorry, the loop is on upper level I tried to make it simpler. I have tried different combinations with my and none worked. for example $a is always 'p' even if the $_[0] was '2'. the loop is feeding the subroutine the proper values.