in reply to Re^2: Loop Control
in thread Loop Control
You're welcome. The confusing part there might be the ternary operator, which you can learn more about in perlop, under Conditional Operator. It's more-or-less an if-then-else conditional, but since it's a single expression, it's easier to plug into a print statement like that. If Perl didn't have it, I'd probably do the same thing with something like this:
{ # start a block to limit the va +riable's scope my $maybe_a_slash = ''; # default to no slash $maybe_a_slash = '/' if $i; # make it a slash if counter ha +s incremented print "$a[$i]$maybe_a_slash$c1[$w]"; } # end the block
Aaron B.
Available for small or large Perl jobs; see my home node.
|
|---|