Tim,
>>>>>>check this if it answers ur #1 question:
#!/usr/bib/perl -w
$\="\n"; # with output record separator used you don't ve to use
# $currentLine = $currentLine . "\x{0A}"; in ur code again
my @arr=qw(item1 item2 item3);
for(@arr){
print $_; # used $_ default argument
# your items are separated without stress
}
>>>>>Also, is there a better way to concatentate?
You can use join like this:
#!/usr/bib/perl -w
use strict;
my @arr=qw(item1 item2 item3); # u can put ur values into an array
$arr=join "*,*",@arr; # use join to ouput all values as a single scalar
value
# concatentate any separator u want, here I
used ","
# in red colour
print $arr;
Thanks
On Wed, Jul 27, 2011 at 9:03 PM, Tim Lewis <[email protected]> wrote:
> I found an answer that I thought I would share.
>
> I am using ActivePerl on Windows server 2003. ActivePerl translates 0A as
> CR\LF. The print statement was causing the issue. To stop this, I added
> binmode to my file handle:
>
> open(OUTPUT,">$outputFileName");
> binmode OUTPUT;
>
> It works great now.
>
>
> ---- Tim Lewis <[email protected]> wrote:
> > I am attempting to add a line feed to the end of each line. When I do
> this, a carriage return is also added. My code lines are:
> >
> > $currentLine = $currentLine . "\x{0A}";
> > $finalOutput = $finalOutput . $currentLine;
> >
> > There has to be a way to do this. Also, is there a better way to
> concatentate?
> >
> > Thanks for any suggestions on this.
> >
> > Tim
> >
> >
> > --
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> > http://learn.perl.org/
> >
> >
>
>
> --
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> http://learn.perl.org/
>
>
>