RosettaCodeData/Task/Bitwise-IO/Perl/bitwise-io-2.pl

7 lines
144 B
Perl
Raw Permalink Normal View History

2013-04-10 16:19:29 -07:00
my $buf = "";
my $c;
while( read(*STDIN, $c, 1) > 0 ) {
$buf = write_bits(*STDOUT, $buf, unpack("C1", $c), 7);
}
flush_bits(*STDOUT, $buf);