That script doesn't produce the error you describe. It generates:

Global symbol "$trans_type" requires explicit package name at noname.p +l line 26. Global symbol "$transaction_id" requires explicit package name at nona +me.pl line 28. Global symbol "$mem_number" requires explicit package name at noname.p +l line 29. Global symbol "$apt" requires explicit package name at noname.pl line +30. Global symbol "$month" requires explicit package name at noname.pl lin +e 31. Global symbol "$year" requires explicit package name at noname.pl line + 32. Global symbol "$amount" requires explicit package name at noname.pl li +ne 33. Global symbol "$gateway" requires explicit package name at noname.pl l +ine 38. Unmatched right curly bracket at noname.pl line 42, at end of line syntax error at noname.pl line 42, near "}" noname.pl has too many errors.

Maybe you should run the sample code you post before you post it to check that it demonstrates the problem you describe?

Note that Perl gives you better ways to generate blocks of inline text:

use strict; use DBI; use CGI::Session; use CGI qw(:standard); my $query = new CGI; print <<HEADER; HTTP/1.0 200 OK\n"; Content-type:text/html <HTML> <Head> <Title>Members</Title> </Head> <body> HEADER my $sid = $query->cookie("CGISESSID") || undef; my $session = new CGI::Session(undef, $sid, {Directory => 'Temp/'}); my $trans_type = 'xxx'; my $transaction_id = 'xxx'; my $mem_number = 'xxx'; my $apt = 'xxx'; my $month = 'xxx'; my $year = 'xxx'; my $amount = 'xxx'; my $naijaXMLRequest = <<XML; <Lastbill>"; <TransactionType>$trans_type</TransactionType>"; <MerchantID>NAIJAMAN009</MerchantID>"; <TransactionID>$transaction_id</TransactionID>"; <MemberNum>$mem_number</MemberNum>"; <apt>$apt</apt>"; <aptExpMonth>$month</aptExpMonth>"; <aptExpYear>$year</aptExpYear>"; <TotalAmountdue>$amount</TotalAmountdue>"; </Lastbill>"; XML my $mem = new LastBill; my $gateway = 'xxx'; $mem->sendHTTP($gateway, "$naijaXMLRequest"); $session->delete(); print qq[<script type='text/javascript'>window.open('','_self','');windo +w.close()</script>];

and that CGI will generate the header for you using print $cgi->header();.

Showing us the CGI related code probably isn't relevant to your issue so you could remove that to focus on the real problem you want help with.

Premature optimization is the root of all job security

In reply to Re: XML not well-formed (invalid token) by GrandFather
in thread XML not well-formed (invalid token) by agsoba83

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.