in reply to Data::Table - empty values - avoid warnings

You can always say no warnings 'uninitialized'; no warnings 'numeric'; to disable this warning in the current scope. And do try to keep this scope small.

Thanks to ikegami for the correction.

Replies are listed 'Best First'.
Re^2: Data::Table - empty values - avoid warnings
by ikegami (Patriarch) on Oct 24, 2007 at 16:09 UTC

    Wrong warning category.

    >perl -wle"no warnings 'uninitialized'; print '' + 4" Argument "" isn't numeric in addition (+) at -e line 1. 4 >perl -wle"no warnings 'numeric'; print '' + 4" 4

    When in doubt use diagnostics or consult perldiag.

    >perl -Mdiagnostics -wle"print '' + 4" Argument "" isn't numeric in addition (+) at -e line 1 (#1) (W numeric) The indicated string was fed as an argument to an oper +ator that expected a numeric value instead. If you're fortunate the me +ssage will identify which operator was so unfortunate. 4
      Thanks, often it directs me to the solution as well but couldn't think of a 'generic' enough fix. I tried something like:

      $t->colsMap(sub { $_->[2] = $_->[0] + $_->[1] if ( length( $_->[1] ) > 0 ) } );

      but that only worked in case of blanks. Happy to have found some alternatives.
      thanks again.