open( my $FH, '<', $file ) or die "Error: can't open file '$file': $!\n"; while( my $fileX = <$FH> ) { chomp($fileX); if (-f $fileX) { my @data = &ReadFile($fileX); print "# Reading $fileX\n", @data; } # if } # while close ($FH); sub ReadFile { my $filename = shift; open( my $FH, '<', $filename ) or die "Error: couldn't open file '$filename': $!\n"; my @lines = <$FH>; close( $FH ); # eigentlich ueberfluessig return @lines; } # ReadFile