open FILE, 'test_file.txt' || die "$!\n"; while ( my $line = ) { die "File is not of UNIX format!\n" if ( $line =~ /\r\n/ ); last; } close FILE;