#!/usr/bin/perl use strict; use warnings; my $file='C:\temp\input.txt'; open(my $fh,'<',$file) or die("ERROR open $file ($!)\n"); my @content = <$fh>; close $fh; my @cleanedContent = grep { chomp && /^->/ } @content; print scalar(@cleanedContent) . " --> größe des cleanedContent\n";