in reply to Loops and variable usage

It seems like your code is equivalent to:
sub ddd { my $a = $_[0] == 1 ? 'p' : $_[0] == 2 ? 'pp' : $_[0]; my $b = $_[1] == 3 ? 'w' : $_[1]; my $c = $_[2]; print v " < $a > < $b > < $c >"; }
Having said that, I don't which problem you are trying to solve. I don't see any loops.

Replies are listed 'Best First'.
Re^2: Loops and variable usage
by BillKSmith (Monsignor) on Mar 24, 2012 at 23:09 UTC
    I find nested ternaries are much clearer using the code layout suggested by the book "Perl Best Practices"
    sub ddd { # code # value my $a = $_[0] == 1 ? 'p' : $_[0] == 2 ? 'pp' : $_[0] ; my $b = $_[1] == 3 ? 'w' : $_[1] ; my $c = $_[2]; print v " < $a > < $b > < $c >"; }