#!/usr/bin/perl use strict; use warnings; while (<>) { my $datapos = tell DATA; while () { print; } seek DATA, $datapos, 0; } __DATA__ foo bar baz Your data here! Add, remove, or change lines while running the program. Every time you hit Return, you will see the current contents of DATA.