in reply to Unmatched right curly bracket ...

Perhaps if you put your code on your scratchpad? Then we could take a look at it.

I'll take a peek if you message me (or reply here) that you have put it there.


UPDATE
Heres my code which appears to work. Note that I have quoted the ENDHTML bits. Take a look at perlfaq4:
Check for these three things: There must be no space after the << part. There (probably) should be a semicolon at the end. You can't (easily) have any space in front of the tag


And the code:
use strict; use warnings; use vars qw($home_fax $Company $position $company_address1 $company_po +stal1 $company_phone $company_fax); $home_fax = "a"; $Company = "b"; $position = "c"; $company_address1 = "d"; $company_postal1 = "e"; $company_phone = "f"; $company_fax = "g"; section2(); sub section2 { print <<"ENDHTML"; one ENDHTML unless ($home_fax eq "") { print <<"ENDHTML"; two ENDHTML } print <<"ENDHTML"; three ENDHTML unless ($Company eq "") { print <<"ENDHTML"; four ENDHTML } unless ($position eq "") { print <<"ENDHTML"; five ENDHTML } unless ($company_address1 eq "") { print <<"ENDHTML"; six ENDHTML } unless ($company_postal1 eq "") { print <<"ENDHTML"; seven ENDHTML } unless ($company_phone eq "") { print <<"ENDHTML"; eight ENDHTML } unless ($company_fax eq "") { print <<"ENDHTML"; nine ENDHTML } print <<"ENDHTML"; ten ENDHTML }
Which prints:
C:\WINNT\PROFILES\simonp\DESKTOP>perl test.pl one two three four five six seven eight nine ten C:\WINNT\PROFILES\simonp\DESKTOP>
I hope that helps :).

Replies are listed 'Best First'.
Re: Re: Unmatched right curly bracket ...
by Gerard (Pilgrim) on Feb 27, 2002 at 11:16 UTC
    Here is the code, I decided to take the Html out to make it less unwieldly...
    sub section2 { print <<ENDHTML; # Html goes in here ENDHTML unless ($home_fax eq ""){ print <<ENDHTML; # Html goes in here ENDHTML } print <<ENDHTML; # Html goes in here ENDHTML unless ($Company eq "") { print <<ENDHTML; # Html goes in here ENDHTML } unless ($position eq "") { print <<ENDHTML; # Html goes in here ENDHTML } unless ($company_address1 eq "") { print <<ENDHTML; # Html goes in here ENDHTML } unless ($company_postal1 eq ""){ print <<ENDHTML; # Html goes in here ENDHTML } unless ($company_phone eq "") { print <<ENDHTML; # Html goes in here ENDHTML } unless ($company_fax eq "") { print <<ENDHTML; # Html goes in here ENDHTML } print <<ENDHTML; # Html goes in here ENDHTML }
    Cheers, Gerard.
      Kill the spaces after each ending tag ENDHTML, because after ENDHTML there must immediately follow a \n; otherwise it is not interpreted as the end of a HERE-Document and an error like this occurs...

      Best regards,
      perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"

        Excellent, by using a combination of simon.proctor'ss and strat's replies, I have been able to solve the problem. Thanks heaps all.
        Regards,

        Gerard
      I know I am not addressing your question, but why use unless when you are checking for truth values?

      I'd rather use if:

      if ($company_fax) { .... }
      instead of:
      unless ($company_fax eq "") .... }
      /prakash