#!/usr/bin/env perl use warnings; use strict; use open IO => ':bytes'; use autodie; open my $fh, '<', 'foo.txt'; $/ = "\x0D"; while (<$fh>) { chomp; ...; } close $fh; __END__