#!/usr/bin/perl use strict; use warnings; my $file = 'whiletest.txt'; my $zeichen; { local $/; open(my $fh,'<',$file) or die $!; $zeichen = length $fh; close $fh; } print $zeichen;