Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to run a script?

Status
Not open for further replies.

ecksit

Technical User
Joined
May 11, 2007
Messages
2
Location
US
Hello, I am extremely noobish when it comes to this. I was just wondering how do you actually go about running and testing a perl script??? I have downloaded something from sourceforge and would like to try it out but I have no idea how to get it to work..

I'm asking this because I have been researching for about a week and trying non stop but couldn't figure it out.. Thanks guys. :)
 
If you're on Windows, you'll need to install ActivePerl first. You can get it by going to and clicking "Perl" at the top of the page, then "Download"

If you're on Linux, you probably already have Perl installed.

On Windows, when you install ActivePerl, all .PL files will have icons on them now (might be a gecko icon or a yellow dot, which are the two I've seen so far from ActivePerl). Double-clicking them will run them, but when they exit (or die of error), the command prompt window that popped up to run them will disappear very quickly.

So, the best way to run them (especially if you're not 100% sure they'll run fine without giving errors like that), is to use the command prompt or terminal.

On Windows, click "Start", "Run", and type "cmd" and hit enter. Navigate to the path you saved your Perl script in, and then type "perl (script name)" to run it.

i.e. if you saved it as "test.pl" in My Documents:
Code:
C:\WINDOWS\System32>cd \
C:\>cd Documents and Settings
C:\Documents and Settings>cd Kirsle
C:\Documents and Settings\Kirsle>cd My Documents
C:\Documents and Settings\Kirsle\My Documents>perl test.pl

That'll run the Perl script, and if the script dies of errors or exits, the command prompt window won't disappear like it does when you double-click to run the script, and gives you time to read any error messages.

-------------
Cuvou.com | The NEW Kirsle.net
 
Oh awesome! Thank you!
 
I did the same downloaded the active state perl thing.
Then installed:
and then played inside perl editor.

A great book to get you started is "Perl in easy steps" I learned perl in 8 hours.

Once you have got started, you can get a webhotel, and upload the scripts to the server and run them on there. remember to have ticked the correct unix/windows line break format. For me it's always Unix.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top