in reply to repeat excel formula

'=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.

Replies are listed 'Best First'.
Re^2: repeat excel formula
by mark4444az (Sexton) on May 22, 2014 at 17:25 UTC
    I see, that works. I will include "use warnings". Thank you very much.