The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

IO::Unread - push more than one character back onto a filehandle

SYNOPSIS

    use IO::Unread;

    unread STDIN, "hello world\n";

    $_ = "goodbye";
    unread ARGV;

DESCRIPTION

IO::Unread exports one function, unread, which will push data back onto a filehandle. If your perl is built with perlio, any amount can be pushed: it is stored in a special :pending layer and read back.

unread FILEHANDLE, LIST

unread unreads LIST onto FILEHANDLE. If LIST is omitted, $_ is unread.

Note that unread $FH, 'a', 'b' is equivalent to

  unread $FH, 'a';
  unread $FH, 'b';

, ie. to unread $FH, 'ba' rather than unread $FH, 'ab'.

Also note that unread is always exported into your namespace.

REQUIREMENTS

PerlIO, Inline::C

BUGS

Doesn't work without perlio.

AUTHOR

Copyright (C) 2003 Ben Morrow <ben@morrow.me.uk>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

PerlIO, "ungetc" in perlfunc