Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Format and Join an Array in a Templateby mscharrer (Hermit) |
on Jun 19, 2009 at 16:03 UTC ( [id://773071]=perlquestion: print w/replies, xml ) | Need Help?? |
mscharrer has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I'm trying to generate a file using the Template module.
I have an array of names and need to produce a comma separated list where each name appears twice in the format ".$name($name)":
@myarray = qw(A B C D E);should produce: Please note that the last line does not end in a comma. If the problem with the last trailing comma would not exits I simple could use FOREACH: Also I know about the possibility to use .join(): which does not allow me to use the names twice. I tried some combinations and checked the manual but could not find a solution yet. Can someone with more experience with Template point me in the right direction? Thanks
Back to
Seekers of Perl Wisdom
|
|