#!/usr/bin/perl use strict; use warnings; use Tie::File; my $file = '/path/to/file'; tie my @lines, 'Tie::File', $file or die $!; for my $index ( reverse 0 .. $#lines ) { next unless $index % 2; splice @lines, $index, 1; } untie @lines;