Hi

Did you try to declare before all the code (right after the modules):

print "Content-type: text/html\n\n";

?

Cheers

Kepler


<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Sem
vírus. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Mon, Oct 16, 2017 at 12:12 AM, Kent Fredric <kentfred...@gmail.com>
wrote:

> On 16 October 2017 at 11:24, David Santiago <deman...@gmail.com> wrote:
> >
> > Hi.
> >
> > How can i have \r\n on my heredoc string when i run my script in linux?
> >
> > my $text=<<"END";
> > This is one line
> > This is another one
> > Final line
> > END
> >
> > When i print this var in my linux box, i get this:
> > "This is one line\nThis is another one\nFinal line"
> >
> > However i want:
> > "This is one line\r\nThis is another one\r\nFinal line"
> >
> >
> > What's the best way of accomplishing this?
> >
> > I know that i can $text=~ s/\n/\r\n/; but i think it must be a better
> > way...
> >
>
> It may help if you explain why you want this, people tend to want the
> opposite behaviour.
>
> However, depending on why, it may be simpler to just encode the \r
> directly in the heredoc, as, after all, they're just strings.
>
> #!perl
> use strict;
> use warnings;
>
> use Data::Dump qw(pp);
>
> pp <<"EOF";
> Hello\r
> World\r
> EOF
>
> ____
>
> "Hello\r\nWorld\r\n"
>
>
> I'm not sure what this does on windows though.
>
>
> --
> Kent
>
> KENTNL - https://metacpan.org/author/KENTNL
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>


-- 










*Rui Miguel FernandesPorto - PortugalWebsites:Novo Milénio - Harmonice
Mundi (A Harmonia dos Mundos)http://novomilenio.eu
<http://novomilenio.eu>Cosmos - Portal Interactivo de Astronomia /
Interactive Gate of Astronomyhttp://cosmos.pt <http://cosmos.pt>*

Reply via email to