if ( -T $currentlog ) #checks wether the file is a text file { open(CURRENTLOG, $currentlog)|| die "file not found: $!"; } else . . .