develooper Front page | perl.beginners | Postings from December 2002

Re: using \n in a cgi script

Thread Previous
From:
Rob Dixon
Date:
December 31, 2002 02:35
Subject:
Re: using \n in a cgi script
Message ID:
20021231103555.62236.qmail@onion.perl.org
Bonjour M Dhoubrechts

Si je vous comprends .. If I understand you, you're expecting the characters
'\n' to appear in the printed output? In Perl, '\n' is one of the short ways
of expressing a single ASCII control character, this one is LF - or
'linefeed' - which has value 10 in the ASCII sequence. Others are \r for
CR - 'carriage return', \t for HT - 'horizontal tab' etc.

This means that you won't see the '\n' in the output, but following text
will start on a new line.

Hope this helps,

Rob

"Dhoubrechts" <dhoubrechts@cybernet.be> wrote in message
news:3E117928.DD1EF17A@cybernet.be...
> Every time I want to use a perl script as a cgi the "\n" ending the
> phrases doesn't make it going at the beginning of the next line. Why ?
> Several script coming from Perl in Action (O'Reilly) have those "\n"
> ending those phrases.
> Here are some lines coming from one of them :
> sub document_de_garde {
>     my $actif = shift;
>     return unless $actif;
>
>     print "<H1>Salut\&nbsp;!</H1>\n";
>     print "Bienvenue dans notre magasin d'habillement\&nbsp;!\n";
>     print "Faites votre choix dans le menu ci-dessous.\n";
>
>     menu_boutique();}
>
> If I want to use them a have to change using print p(...); ?
> Thanks for response.



Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About