Why bother with your own $i variable when Perl gives you $. for free?
perl -i -ne 'print if $. % 2' filename
(which is, of course, pretty much what broquaint had above)
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re^2: Even and uneven numbers as RegEx
by davorg
in thread Even and uneven numbers as RegEx
by New Novice
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |