in reply to Re: print a hohoh
in thread print a hash ref

ok thank you! it ran to completion, however I dont want the GB or MB printed which is why I put it as a value: any way I can only print the 1.0 in mxs and not the GB? I still need the letters GB/MB but cannot have them in the gmetric CLI. maybe use an array to store GB/MB?
'/cache-m/usr/cachesys/mgr/' => { 'free' => '91.7', 'sz' => '1.0', 'mxs' => { '1.0' => 'GB' }, 'dfree' => '2.2', 'avail' => '917'

Replies are listed 'Best First'.
Re^3: print a hash ref
by nemesdani (Friar) on Jul 09, 2013 at 14:14 UTC
    Not a nice way, but if it's only for printing, treat it like a number, e.g. add 0 to it and print the result.


    I'm too lazy to be proud of being impatient.
      well its a lot of prints, 114 to be exact.

        You should not have 114 prints.

        Try replacing them with a loop around a single print:

        print "$key : $hash{key}\n" for (keys %hash)
        So? You have to modify print only once.


        I'm too lazy to be proud of being impatient.