|
|
| "be consistent" | |
| PerlMonks |
print last array element without a new lineby sy (Initiate) |
| on Oct 19, 2011 at 19:26 UTC ( #932480=perlquestion: print w/ replies, xml ) | Need Help?? |
|
sy has asked for the
wisdom of the Perl Monks concerning the following question:
I'm very new to Perl so please excuse the simple question. I'm processing CSV files and for each record I split the record by comma and then printout a subset of fields in rearranged form. My problem is that I cannot print the LAST element of an array without also getting a newline. This is a problem because I want the last array element to be in the middle of a new record. I've tried using chomp (multiple times) on the input line, the array, or the array element, and I've consulted much documentation to no avail. Can someone offer and explanation and fix that suits a beginning programmer? For example, in the simplified but representative code below I get an unwanted new line after $field10
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||