in reply to Reading binary data from a socket?

Perl doesn't really distinguish between text and binary data heres a kind of way to do what you want (untested).
# create socket $sock with IO::Socket or similar my @headers; while (<$sock>) { last unless /\S/; # end on a blank 'line' ("\n\n"), like in HTTP chomp; push @headers, $_; } while (defined($_ = getc($sock))) { my $dec = ord($_); # process eithier $_, the ascii equivilent or $dec, the decimal valu +e }