On Sun, 2 Jan 2005, Siegfried Heintze wrote:

> The following code does not work quite right because it has a trailing ", ".
> 
> $sMainTable[2] .= $PCEs[$case_count]{$_}.", " foreach keys
> %{$PCEs[$case_count]};
> 
> How could I rewrite this, perhaps with a join statement/function, so there
> is no trailing ","?
 
The usual idiom is something like this:

  $foo = join( ", ", keys %bar );

So in this case, maybe...

  $sMainTable[2] = join( ", ", keys %PCEs[$case_count] );

...or something to that effect.

If you have _Perl Cookbook_, it has sections on commifying lists.

 

-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to