sselva has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,
I have a small question regarding formating text while download .

Note :i am having this script in linux

Content-Type: text/html

Content-disposition: attachment; filename=detail.txt

$fan= "foobar";

$Qman="test system ";

#sprintf '<%6a>',"$fan :$fan";

print "$fan : $fan \n\t";

print "Qman : $Qman\n\t";

while i downloaded the attachment it shows in a different format like :

fan:foobar<spceial cahrs> Qman:test system ( i could not able to paste the exact output here sorry for that)

. I used sprintf too .

But could not able to get the desired output .

i am trying to do this for last 2 days but it was abortive

could you plesae help me to over come from this .

thanks in advance .

Out put should like

fan : foobar

Qman : test system

Replies are listed 'Best First'.
Re: Formating text while download
by Utilitarian (Vicar) on Jul 30, 2009 at 07:14 UTC
    The issue may be that you are looking at a Unix file on an MS system, they differ in their understanding of what constitutes a line break. You could modify your output to be suitable for reading on an MS system as follows
    print "$fan : $fan \r\n\t";
      Or if you don't want to remember to write a \r next to an \n everywhere, you can apply the :crlf IO layer:
      binmode STDOUT, ':crlf'; print "$fan: $fan \n\t";
Re: Formating text while download
by Anonymous Monk on Jul 30, 2009 at 03:49 UTC
    Content-Type: text/html Content-disposition: attachment; filename=detail.txt
    is it text or html?
      its text file .
        So why are you saying its html?