in reply to
Re: true/false condition - what am I doing wrong?
in thread true/false condition - what am I doing wrong?
The ternary operator is stackable. So for three choices, the following might be bearable:
use strict;
use warnings;
for my $type ( qw(add edit nada) ) {
my $redo = $type eq 'add' ? 'wiki_add2'
: $type eq 'edit' ? 'wiki_edit2'
: 'error';
print "$type -> $redo\n";
}
__END__
add -> wiki_add2
edit -> wiki_edit2
nada -> error
But as AM points out, the OP's task seems to call for a dispatch table.