#!/usr/bin/perl use strict; use warnings; my $file='C:\temp\input.txt'; my @content; open(my $fh,'<',$file) or die("ERROR open $file ($!)\n"); while ( my $line = <$fh> ) { next if $line =~ m{\A#}; next if $line =~ m{\A\s*\z}; push @content, $line; } close $fh; print scalar(@cleanedContent) . " --> größe des cleanedContent\n";