#!/usr/local/bin/perl -w use strict; $|++; my $r; while($r=) { print "hi$r"; if($r eq "\n") { last; } print "bye$r\n"; } __DATA__ 1 2 3 4