Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Supressing zero values in formatted reports

by Fengor (Pilgrim)
on Dec 28, 2001 at 14:04 UTC ( #134836=note: print w/ replies, xml ) Need Help??


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"


Comment on Re: Supressing zero values in formatted reports
Select or Download Code
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://134836]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2014-12-19 02:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (70 votes), past polls