- or download this
my $hash = { a => 'b' };
$hash->{$x}
- or download this
{a => 'b'}->{$x}
- or download this
sub some_function
{
...
( $x eq 'qaz' ) ? "results for qaz" :
" ... and so on, ad nauseum";
}
- or download this
sub some_function
{
...
qaz => "results for qaz",
}->{$x} || "... and so on, ad nauseum";
}
- or download this
#!/usr/bin/perl
...
ternary => sub { ternary( $strings[$i++] );
$i = 0 if ( $i == @strings ) },
} );
- or download this
Rate anonhash ternary
anonhash 64869/s -- -72%
ternary 232475/s 258% --
- or download this
Rate anonhash ternary
anonhash 26893/s -- -87%
ternary 204817/s 662% --