In a previous journal entry, I reduced an if-elsif and Douglas Wilson showed another way to save a bit of typing. A few other people wrote to me with other sorts of solutions, which reminded me of another trick.
References can help you make decisions as late as possible, and when you really get you really chug from the Perl Kool-Aid you tend to delay decisions to the last possible moment. References can stand in place of named variables---a variable for variables, perhaps.
If I have a simple assignment to a scalar variable, Perl figures out where the data will live at compile time because that little chunk of memory has a name, and you use that name explicitly. Perl knows this at compile time.
my $foo = 'Hello Perl!'
my $ref = $condition ? \$foo : \$bar; $$ref = 'Hello Perl!';
my( $ref1, $ref2 ) = ( \$param1, \$param2 );
if( $$ref1 > 5 and $$ref2 > 9 ) { ... }
my( $ref1, $ref2 ) = @param_refs;
my( $ref1, $ref2 ) = @_;