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

Hi, I have a question on using the Win32::OLE module. I want to have a range of values for my excel graph but want to be able to change it depending on user input. For instance, before I start my script I will ask the user what the X axis range will be. My question is how would I change the $Range variable to accomplish that. Currently, the only way I know how to set the range is to hardcode it like the example below. Here the range is set from 3.0 to 4.0 with 0.1 increments. Can anyone tell me how I would be able to change this so if user specified a range from 1.0 to 3.0 with 0.1 increments then my script would be able to handle this?
$Range->{value} = [['voltage', "cell($cell_addr)"], [3.0, $icell_hash{$cell_addr}{' 3.00'}], [3.1, $icell_hash{$cell_addr}{' 3.10'}], [3.2, $icell_hash{$cell_addr}{' 3.20'}], [3.3, $icell_hash{$cell_addr}{' 3.30'}], [3.4, $icell_hash{$cell_addr}{' 3.40'}], [3.5, $icell_hash{$cell_addr}{' 3.50'}], [3.6, $icell_hash{$cell_addr}{' 3.60'}], [3.7, $icell_hash{$cell_addr}{' 3.70'}], [3.8, $icell_hash{$cell_addr}{' 3.80'}], [3.9, $icell_hash{$cell_addr}{' 3.90'}], [4.0, $icell_hash{$cell_addr}{' 4.00'}],

Replies are listed 'Best First'.
Re: Win32::OLE X-Axis range question
by Anonymous Monk on Mar 12, 2009 at 06:43 UTC
    print $_,$/ for ronge(qw( 3.0 4.0 0.1 )); sub ronge { my( $lll, $rrr, $iii ) = @_; my @rrr = $lll; while( $lll <= $rrr ){ $lll += $iii; push @rrr, sprintf '%.1f', $lll; } return @rrr; } __END__ 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4.0
      I would like to change my $Range variable to be dynamic. I am still not sure how I would do that if for instance I would want to have a range from 1.0 to 8.0 with 0.1 increments.
        I don't follow