in reply to Re^4: Formatted output file with data processing
in thread Formatted output file with data processing
The problematic statement is
my $fmt = $odd_format{$register} // $default_format;
which uses the // (defined-or) operator introduced with Perl version 5.10.
Because any value of $odd_format{$register} (i.e., a format string) is highly unlikely to be false (see What is true and false in Perl?), it's almost certainly ok to use the || (logical-or) operator instead (all the following alternatives are untested):
my $fmt = $odd_format{$register} || $default_format;
An absolutely bullet-proof alternative uses exists and the ? : (ternary) operator:
my $fmt = exists($odd_format{$register}) ? $odd_format{$register} : $default_format;
Give a man a fish: <%-{-{-{-<
|
|---|