• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

whitespace and perl....

gopunk

Lifer
is whitespace in the code an issue? i only ask because when i tab EOF, it breaks the code, but when there is no leading whitespace, it works fine. just wondering what could be causing this. thanks!
 
Whitespaces shouldn't cause any problems (unless its part of a string, obviously).

Can you give more info about the problem? Are you trying to detect the EOF for a data file you are reading/writing too? Can you give a code snippet?
 
yea sure:




print <<EOF;
<HTML>
<HEAD><TITLE>Hello, world!</TITLE></HEAD>
<BODY><H1>
EOF

if (-e "$path/$filename"){
print <<EOF;
Hello, world!
EOF
}


else {
print <<EOF;
$path/$filename does not exist!
EOF
}

print <<EOF;
</H1></BODY>
</HTML>
EOF




if i tab the EOF's at the end of each print thing, weird things happen. if i tab the one at the end of the first, third, or fourth one, i get an internal server error. if i tab the one at the end of the second one, i get a blank page with the correct page title.
 
it is only an issue if you are using it the way you are (printing multiple lines).
this is also true for shell scripts

the thing is, the print for multiple line is looking for the ending mark (in your case, the "EOF")
with it not at the first column of the line, the print will think that it's not the EOF that you are looking for, and will just disregard it and moving along... until you reach the end of your script, it still haven't found the corresponding EOF, and your code will bomb out ...

btw, the internal server error you are getting is because the cgi handler (i'm assuming you are writing this for cgi script) gets an error message from the perl interpreter of your web server. since it doesn't know how to handle perl errors, it gives you internal server error....

-949-
 
Back
Top