package rdw; use strict; use warnings; sub PUSHED { bless \*PUSHED,$_[0] } sub FILL { my ($length, $record); read $_[1], $length, 1; return undef if eof $_[1]; read $_[1], $record, $length; # uncomment next line to see it is actually working # print "$record\n"; return $record; } sub WRITE { return undef } package main; open( my $in, '<:via(rdw)', 'foo.txt' ) or die $!; while ( <$in> ) { print "$_\n"; } __END__ # foo.txt - output is aababc 1a2ab3abc