#!/usr/bin/perl use strict; use warnings; use Tie::File; my $file = '/pfad/zu/datei.txt'; tie my @lines,'Tie::File',$file or die $!; @lines = grep{$_ !~ /^\s*$/}@lines; untie @lines;