'=B'.$line_count - 'B'.($line_count_plus_1)
should be
'=B'.$line_count .' - B'.($line_count_plus_1)
or
"=B$line_count - B$line_count_plus_1"
Your minus sign is outside your quotes - you're subtracting in Perl, not Excel. This would have gotten caught if were using warnings. See Use strict warnings and diagnostics or die.
I'd probably use sprintf instead of creating a one-off variable:
sprintf '=B%d - B%d', $line_count, $line_count-1
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|