#!/usr/bin/perl use warnings; use strict; # Test linereading open (TEST, 'test.txt') or die "Unable to open test.txt file: $!\n"; #open (TEST, "gunzip -c test.txt.gz |") or die "Unable to open pipe: $!\n"; while () { print "$_"; seek(TEST, -length($_), 1); # place the same line back onto the file handle }