while($l = ) { @a = split(/\s+/, $l); $s = ""; for ($i = @a; $i > 0; $i--) { $s = "$s$a[$i-1] "; } chop($s); print "$s\n"; }