my $fh = Compress::FQZ::Reader->new($fn); while (<$fh>) { # ... } my $fh = Compress::FQZ::Writer->new($fn); while ($foo) { print {$fh} $bar; }