$x= cond() ? this() : that();
# vs.
if( cond() ) {
$x= this();
} else {
$x= that();
}
####
my $x= cond() ? this() : that();
# vs.
my $x;
if( cond() ) {
$x= this();
} else {
$x= that();
}
##
##
$x= cond() ? this() : that();
# vs.
sub pick {
if( cond() ) {
return this();
} else {
return that();
}
}
$x= pick();
##
##
my $x= DoSomething(
cond() ? this() : that(),
$whatever,
foo() ? bar() : baz(),
$blah,
);
##
##
s{
# Some fairly complex parsing regex
}{
my( ... )= ( $1, $2, $3, $4 );
if( ... ) {
...
"replacementString";
} elsif( ... ) {
...
"differentReplacement";
} else {
"somethingElse";
}
}gex;