|
Joined: Sep 2000
Posts: 138
Member
|
Member
Joined: Sep 2000
Posts: 138 |
I have just learned perl and got the $ to display somthing automaticly today. I was wondering what was wrong with this script: This was a test script. So can you help?------------------ [This message has been edited by Em8 (edited September 08, 2000).]
|
|
|
|
Joined: May 2000
Posts: 243
Member
|
Member
Joined: May 2000
Posts: 243 |
get ride of all the "my"s in front of the variables. you don't need thme. This below is an example of useing it: ========================= &goto("Hi"); sub goto { my $variable = shift; print "$variable"; } ========================= Even when you delete all the my's in front. You'll still get a white page. Try this: ========================== use CGI qw/:standard/; if (param('action') eq 'TopHTML') { &TopHTML; } ========================== Now from your browser: http://www.yoursite.com/cgi/yourscript.cgi?action=TopHTML If you would rather it link to like yourscript.cgi?action=top change TopHTML to... ==================== if (param('action') eq ' top') { &TopHTML; } ==================== Hope that helps ------------------ My Freeware Board
|
|
|
|
Joined: Aug 2000
Posts: 3,590
Moderator
|
Moderator
Joined: Aug 2000
Posts: 3,590 |
No, no, no, no....Getting rid of the my's would actually cause an error when using strict, which should always be done. Your "scope" must be specified... ------------------ I wish I were a Canuck All they have to do is drink beer, play hockey, and say "Eh" * No offense meant to any Canadians
|
|
|
|
Joined: Sep 2000
Posts: 755
P.I.T.A. / Programmer
|
P.I.T.A. / Programmer
Joined: Sep 2000
Posts: 755 |
Get rid of the my's??? Just because you don't understand something doesn't mean you should tell people not to do it. My's are a good thing. It's called proper programming.
Now to the root of the problem:
1) The heredoc is wrong:
print <: : HTML
That close should be TOPHTML, not HTML
2) there's no actual call in the code to sub TopHTML so the routine is never getting executed.
--mark
------------------
"Annnnnnnndd now, opening for Iron Maiden...... WYLD STALLYNS!!!" --Bill S. Preston, Esquire and Ted "Theodore " Logan
|
|
|
|
Joined: Sep 2000
Posts: 138
Member
|
Member
Joined: Sep 2000
Posts: 138 |
So, like I uploaded it just like that but I was wondering, the print "Content-type: text/htmlnn"; print " &TopHTML; "; &TopHTML; should I remove print "Content-type: text/htmlnn"; print " &TopHTML; "; or should I remove &TopHTML; or leave it like it is? Thanks for all the help!
|
|
|
|
Joined: Aug 2000
Posts: 3,590
Moderator
|
Moderator
Joined: Aug 2000
Posts: 3,590 |
You need the content line always when you are printing to a browser. Remove the print " &TopHTML"; line...
------------------ I wish I were a Canuck All they have to do is drink beer, play hockey, and say "Eh"
* No offense meant to any Canadians
|
|
|
|
Joined: May 2000
Posts: 243
Member
|
Member
Joined: May 2000
Posts: 243 |
my goodness people I'm still learning perl myself so please you don't need to jump on my back you could atleast politly correct me... ------------------ My Freeware Board
|
|
|
|
Joined: Sep 2000
Posts: 755
P.I.T.A. / Programmer
|
P.I.T.A. / Programmer
Joined: Sep 2000
Posts: 755 |
If you're just learning yourself, then you have no right telling people to do or not do something, especially if you have no idea what it is.
Polite? Not my style. It pisses me off when wrong or bad information is passed on too people, especially when the people doing the passing are not simply misinformed, but rather have no basis for the information they provide.
--mark
------------------
"Annnnnnnndd now, opening for Iron Maiden...... WYLD STALLYNS!!!" --Bill S. Preston, Esquire and Ted "Theodore " Logan
|
|
|
|
Joined: Aug 2000
Posts: 3,590
Moderator
|
Moderator
Joined: Aug 2000
Posts: 3,590 |
If you teach someone the wrong way to to do something, than it's no good.... ------------------ Da Wannabe Cannuck Andy Tomaka YaBB Developement Team [email protected]http://www.yabb.org
|
|
|
|
Joined: Sep 2000
Posts: 138
Member
|
Member
Joined: Sep 2000
Posts: 138 |
Ya. I mean he tried to help. ------------------
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 449
Joined: February 2008
|
|
Forums63
Topics37,573
Posts293,925
Members13,849
|
Most Online5,166 Sep 15th, 2019
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|