# example 1 while($l = ) # reads one line at a time from { $s = ""; # assigns the empth string to $s foreach $i (reverse(split(/\s+/, $l))) # creates an array $i and places { # the words from $l in reversed order into $i $s = "$s$i "; # makes $s a string of elements of $i } chop($s); # chops off one word at a time from the front of string print "$s\n"; # prints that word }