> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 04, 2002 2:51 PM
> To: [EMAIL PROTECTED]
> Subject: converting a list into array
> 
> 
> Hi,
> 
> I have a file with a list of symbols:
> 
> AAPL
> AMCO
> IBM
> ORCL
> 
> I want to print like 
> 'AAPL','AMCO','IBM''ORCL'

Assuming you want a comma between those last two:

   print join(',', map {chomp; "'$_'"} <DATA>), "\n";
   __DATA__
   AAPL
   AMCO
   IBM
   ORCL

Or, if you want an array in there:

   chomp(@list = <DATA>);
   print join(',', map "'$_'", @list), "\n";
   __DATA__
   AAPL
   AMCO
   IBM
   ORCL

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to