in reply to To read Char-by-Char from a file

sysread(FILE,$buffer,1);

Replies are listed 'Best First'.
Re^2: To read Char-by-Char from a file
by polettix (Vicar) on May 12, 2005 at 18:21 UTC
    Absolutely. This has the added benefit to bypass Perl's buffered IO, which is what one really wants if (s)he needs to read a precise amount of data from a "source".

    In addition, if you want to read byte-by-byte instead of char-by-char (which is different due to Unicode support), it's safer to use binmode:

    binmode FILE; sysread(FILE,$buffer,1);

    Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')

    Don't fool yourself.