in reply to Re^2: doughnut charts with gd:graph
in thread doughnut charts with gd:graph

Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/vg_mail-lv_var 94959436 1415576 88713448 2% /var

That explains why the scalars are not set for you. If your Filesystem paths are so long as to overflow like this you will need to use -P. That will avoid the wrapping and hence the assignment errors. Note that this is a demonstrably good reason not to shell out but to use a module instead.

Here is an SSCCE demonstrating this use of -P:

#!/usr/bin/env perl use strict; use warnings; my @df = `df -P /var`; my ($used, $free) = (split (/\s+/, $df[1]))[2,3]; print "used $used, free $free\n";

The split acts on $df[1] (which is the second line returned by df) and splits it on whitespace (like awk does). You then want only the 3rd and 4th fields for your used and free figures but indexing in Perl starts at zero hence the slice of [2,3]. Hopefully that makes it clear enough?

Replies are listed 'Best First'.
Re^4: doughnut charts with gd:graph
by Tux (Canon) on Jul 26, 2018 at 11:31 UTC
Re^4: doughnut charts with gd:graph
by theravadamonk (Scribe) on Jul 26, 2018 at 10:30 UTC

    Hopefully that makes it clear enough?

    Yeah, It's pretty clear. I realized it. Thanks for it.

    You already have the image as a pie so why not just overlay a background-coloured circle on the middle?

    Whole day, I tried, But, still no success..

    Could you pls give a try? It may be easy for you. I don't Want to stop writing this code.. I want to continue..

    The other thing is How to Display values ($used and $free ) in pie chart?

    in Bar chart,We have below line

    show_values => 1,

    I need everyone's replies to complete this code.