use warnings; use strict; use File::Comments; my $snoop = File::Comments->new( default_plugin => "File::Comments::Plugin::C"); my $strip = $snoop->stripped('yourfile'); open IN, "<", \$strip; while ( ) { chomp; @_ = split /\|/; next unless $_[5]; #Your processing here }