For stuff like this I kind of cheat and use -M'5;my $total = 0;' instead (although I wouldn't just for zero since undef does the right thing anyhoo). That along with the eskimo kiss trick (closing the implicit -n or -p while block with }{ ; using -MO=Deparse can show what you're really getting) lets you handle most things.
perl -F, -M'5;my $t = 0' -lanE '$t += $F[2];}{ say $t' some_file.csv
Edit: And I'd never use -n in a shebang line, just when trying for a (too) clever / short one-liner. If you're not golfing or sticking this in the middle of a pipeline it's much better to be explicit in your script and not need to bother with tricks to get reasonable scoping.
The cake is a lie.
The cake is a lie.
The cake is a lie.
In reply to Re: Initialize variable in BEGIN
by Fletch
in thread Initialize variable in BEGIN
by BillKSmith
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |