Aquariophile: Perlscripte in Plaintext ausgeben

Hallo!

Ein Perlscript soll in Plaintext ausgegeben werden.
Dazu dachte ich an den print <<'EOF';

Beachtet bitte alle Leerzeilen die ich machte (welche erhalten bleiben sollen)

egal ob ich es mit <<"EOF" oder <<'EOF'; oder <<EOF; mache,
es kommt immer was anderes raus als im Source steht.

Bitte um Hilfe.

Ganz unten steht wie es aussehen sollte.

Danke!

DAS SCRIPT:

#!/usr/bin/perl

print "Content-type: text/html\n\n";
print "<html><head><title></title><body bgcolor="#FFFFFF">";

print <<'EOF';
#############################################################

$bla="a:b:c:d:e:f:g";
($login,$passwd,$uid,$gid,$gcos,$home,$shell) = split(/:/, $bla);

print $login."<br>\n";
print $passwd."<br>\n";
print $uid."<br>\n";
print $gid."<br>\n";
print $gcos."<br>\n";
print $home."<br>\n";
print $shell."<br>\n";

#############################################################

EOF

print "</body></html>";

IM BROWSER STEHT BEI <<'EOF' dann:

############################################################# $bla="a:b:c:d:e:f:g"; ($login,$passwd,$uid,$gid,$gcos,$home,$shell) = split(/:/, $bla); print $login."
\n"; print $passwd."
\n"; print $uid."
\n"; print $gid."
\n"; print $gcos."
\n"; print $home."
\n"; print $shell."
\n"; #############################################################

IM BROWSER BEI <<"EOF";

############################################################# ="a:b:c:d:e:f:g"; (,,,,,,) = split(/:/, ); print ."
"; print ."
"; print ."
"; print ."
"; print ."
"; print ."
"; print ."
"; #############################################################

IM BROWSER BEI <<EOF;

############################################################# ="a:b:c:d:e:f:g"; (,,,,,,) = split(/:/, ); print ."
"; print ."
"; print ."
"; print ."
"; print ."
"; print ."
"; print ."
"; #############################################################

UND SO SOLLTE ES AUSEHEN:

#############################################################

$bla="a:b:c:d:e:f:g";
($login,$passwd,$uid,$gid,$gcos,$home,$shell) = split(/:/, $bla);

print $login."<br>\n";
print $passwd."<br>\n";
print $uid."<br>\n";
print $gid."<br>\n";
print $gcos."<br>\n";
print $home."<br>\n";
print $shell."<br>\n";

#############################################################

DANKE!
Aquariophile

  1. hi,

    egal ob ich es mit <<"EOF" oder <<'EOF'; oder <<EOF; mache,
    es kommt immer was anderes raus als im Source steht.

    Jow, das ist das quoten ;-)

    So wie du EOF quotest wird das ganze here Doc auch ge-quotet.
    Beispiel: 'EOF';
    \n wird als \n geprintet
    "EOF";
    \n ist ein Newline

    Rolf

  2. Hallo Aquariophile,

    Setze um das Ganze ein
    print "<pre>\n";
    print <<'EOF';
    ...

    EOF
    print "</pre>\n";

    Die <br> mußt Du maskieren.

    Gruß

    Eidgenosse