in reply to Re^3: Formatted output file with data processing
in thread Formatted output file with data processing

Thanks a lot for your respond but somehow this is not available "use 5.010"

Thanks Kshitij
  • Comment on Re^4: Formatted output file with data processing

Replies are listed 'Best First'.
Re^5: Formatted output file with data processing
by AnomalousMonk (Archbishop) on Oct 03, 2019 at 17:01 UTC

    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:  <%-{-{-{-<

Re^5: Formatted output file with data processing
by hippo (Archbishop) on Oct 03, 2019 at 08:18 UTC

    Your installation of perl is over 12 years old. Either upgrade to a vaguely recent version or at the very worst stipulate which version you have (and which O/S: make, model, version) and state why you are unable to upgrade.

      I am not having administrator rights so difficult to upgrade.

        Do you have a home directory? You can install a newer perl in there which won't require any administrator rights.

        You still haven't said which perl version or O/S version you are currently using.