Vulnerability Development mailing list archives

Re: Coding Conservative CGI Perl


From: FBO <fbo2 () gmx net>
Date: Tue, 11 Jun 2002 07:35:36 +0200

Hi perl-fans,

On Mon, Jun 10, 2002 at 08:54:41PM +0200, Joerg Over wrote:
Am 00:27 10.06.02 -0500 schrubst Du:
->#!/usr/bin/perl
->print "Content-type:text/html\n\n";
->print "SUP!<BR>";
->
->This will not work but recoded to work (not having spaces) would be:
->
->#!/usr/bin/perl
->print("Content-type:text/html\n\n");
->print("SUP!<BR>");
->
->You can have just about any character other than spaces... I'm no good
with perl really unfournately although I have read quite a number of
articles the only thing I've successfully found remotely useful was using
print($ENV{DOCUMENT_ROOT}); to find the location of the file heh.

perl is quiet flexible in that respect.
Since you seemingly can use newlines, just use them wherever you otherwise
can't avoid a space.

#!perl
kill
$$
or
die

IMHO no spaces, newlines or other \s-chracters are really needed in a perl
script. 1 newline is needed whenever '#!/usr/bin/perl' at the beginning
can't be avoided.

For example:

#!/usr/bin/perl
print "foo bar blahblah
";
print ( 1 and 1 ) . "\n";

could be rewritten to

#!/usr/bin/perl
print("foo\040bar\040blahblah\n".((1)and(1))."\n");

->no spaces, just a single newline.

perl rulez :-) ...

FBO


Current thread: