http://www.perlmonks.org?node_id=134836


in reply to Supressing zero values in formatted reports

From the perfunc page of format:
format Something = Test: @<<<<<<<< @||||| @>>>>> $str, $%, '$' . int($num) . $str = "widget"; $num = $cost/$quantity; $~ = 'Something'; write;
so maybe u can do something like:
format top = User Emails Size (Kb) ============== ======== =========== . format DISPLAY = @<<<<<<<<<<<<< @#### @#####.## $temp[$i], $temp[$i+1], $temp[$i+2] . if ($output[$i]) {$temp[$i]=$output[$i]} else {$temp[$i]==' '} if ($output[$i+1]) {$temp[$i+1]=$output[$i+1]} else {$temp[$i+1]==' '} if ($output[$i+2]) {$temp[$i+2]=$output[$i+2]/1024} else {$temp[$i+2]==' '}
hth
fengor

--
"WHAT CAN THE HARVEST HOPE FOR IF NOT THE CARE OF THE REAPER MAN"
-- Terry Pratchett, "Reaper Man"

Replies are listed 'Best First'.
Re: Supressing zero values in formatted reports
by ryan (Pilgrim) on Dec 28, 2001 at 14:57 UTC
    Thanks, however that causes the same Argument " " isn't numeric in formline error that setting it to blank does.
      Hmm this isn't an error. It's a warning.

      From perldiag: Argument "%s" isn't numeric%s

      (W) The indicated string was fed as an argument to an operator that expected a numeric value instead. If you're fortunate the message will identify which operator was so unfortunate.

      This means although the warning is displayed your program should run normally.

      hth
      fengor

      --
      "WHAT CAN THE HARVEST HOPE FOR IF NOT THE CARE OF THE REAPER MAN"
      -- Terry Pratchett, "Reaper Man"

        Correct. Warning. Sorry. However it still prints a zero in the spots that I want blank.
        Correct, I'll rephrase that to Warning, and continue to comment that it still does not suppress zero values.