Gossamer Forum
Home : General : Perl Programming :

Question from Perl newbie

Quote Reply
Question from Perl newbie
Hello,

I just started to self-teach myself how to program with Perl, and I have slight issues regarding file handling. I tried to run my perl program using command prompt by typing in Perl\filename, and it opens up the text file instead of running the actual program. Can someone explain to me what is going on? Your reply would be more than welcome.

Young
Quote Reply
Re: [Young] Question from Perl newbie In reply to
Hi. When running from command line, you may need to type;

/full/path/to/perl /full/path/to/script.cgi

.. or

perl /full/path/to/script.cgi

Are you on NT or UNIX for your development server? (will decide ultimatly how you run the scripts from command prompt).

BTW... you should just run them via browser really =)

Just be sure to set a header;

Code:
print "Content-type: text/html \n\n";

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Question from Perl newbie In reply to
Hello, Thank you for replying to my queries. I have another question regardingrunning the program via browser (exactly what is this browser that you are talking about?)In (print "Content-type: text/html \n\n";) which you have mentioned, could you brieflyexplain what I have to type in content-type section and the text section? After I type the given line, what must I type to actually run the program? Young
Quote Reply
Re: [Young] Question from Perl newbie In reply to
Code:
#!/usr/bin/perl

print "Content-type: text/html \n\n";

print "This is just a test...\n<BR>";

... then upload to your site, and run it with;

http://www.yoursite.com/cgi-bin/test.cgi

... where yoursite.com is your site, and "cgi-bin" is the folder where you upload the file.

There are a *ton* (and I mean it) of resources on the internet... from basic Perl scripts, to writing your own web-based email program. The best bit of advice I can really give you, is to check out Google =) (try a search for: "learn Perl").

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!