in reply to Re: elsif stupid question...
in thread elsif stupid question...

Optionally, the nested ternary is good for long chains of if/elsif/else

#! /usr/bin/perl -w use strict; (my $foo = shift) ||= 0; ($foo == 1) ? print "It's one\n" : ($foo == 2) ? print "It's two\n" : ($foo == 3) ? print "It's three\n" : print "It's nothing meaningful!\n";

Replies are listed 'Best First'.
Re^3: elsif stupid question...
by blazar (Canon) on Apr 28, 2005 at 15:44 UTC
    Personally I try to avoid using?: for its side effects, when not golfing - that is! Re the example you gave, a hash or an array would have provided a much neater solution.