Title: Reverse of Chomp...
Thanks to all, it seems  join("\n",@array) will do exactly
what I need. And for the STDOUT part, just tack on the
extra \n for the last element.
 
I'll have to look at join again to see what else it can do
as well as map.
 
Thanks for the info.
George
-----Original Message-----
From: George Gallen [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 12, 2003 4:46 PM
To: [EMAIL PROTECTED]
Subject: Reverse of Chomp...

Is there a way to reverse chop/chomp

I'm reading <STDIN> into an array, then
   chomping off the last character of each of the
   array elements.

Now I'd like to write the array back out
  to <STDOUT>, but I want to put the \n's back between
  each of the lines.

Aside from looping through the array, and
   print each element followed by a \n to <STDOUT>
   is there an easier way like:

   unchop(@array) ; <STDOUT> = @array ;

I guess I could write a short subroutine, but didn't
want to re-invent the wheel, even though there isn't
much re-inventing in that routine.

Thanks
George

Reply via email to