Hey Thanks a lot. I got it. I greatly appreciate your help. I have another small issue. when I get the array of something I extract, I try to print them using the code
if (ref($bar) eq "ARRAY") {
foreach my $q (@$bar){
print FH $q ,",";
}
} else {
print FH $bar;
}
But, this doesn't seem to be of help. I want to do something that if its an array separate them by ',' else just print the individual without ','. But when I use the above code it also prints the single element with a ',' and in an array it gives ',' after the last element. I know how to solve the same issue in XSLT its something like
<xsl:test if position() != last()>
<xsl:value-of select="."/>;
</xsl:test>
<xsl:test if position() = last()>
<xsl:value-of select="."/>
</xsl:test>
Thus everything is separated by ';' except for the last element and if its only a single element then it gets printed as it is. Can I do something same in perl, can you please help.
Thank you,
Sammed
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|