#!/usr/local/bin/perl -w use strict; use Tie::File; use Fcntl 'O_RDWR'; #my $file = q(/var/log/cisco.log); my $file = q(cisco.log); tie my @array, 'Tie::File', $file, mode=>O_RDWR; for my $i (reverse 0.. $#array){ splice(@array,$i,1) if($array[$i]=~/Fan 2 not rotating/); } untie @array;