taiq_m has asked for the wisdom of the Perl Monks concerning the following question:

I have the below piece of code and a problem is when I am trying to plot a graph from a csv file where i have replaced the 0s with undef, the undef still gets plotted as undef. I have turned on show_values and I see the undef. It is taking undef as a string.

cat test.csv 1,undef,2 2,3,undef my $data = GD::Graph::Data->new(); $data->read(file => '/tmp/test.csv', delimiter => ',');

Replies are listed 'Best First'.
Re: Replace data inside GD::Graph::Data object
by huck (Prior) on Mar 14, 2017 at 02:14 UTC

    Comming from a file, csv or not, undef is just another text string, unlike in perl code where undef has a specific meaning to the compiler

      thanks huck - i kind of got it, question is how do i replace it ? can I access the data with in the Graph:Data object ?

        figured out, it works

        foreach my $arr (@$data) { @$arr = map {$_ eq "undef" ? undef : $_ } @$arr; }