| Home | “See http://perldoc.perl.org/ for complete Perl programming documentation.” |
Remember when the IBM PC first came out, and you used “BASICA” or “GWBASIC” to do “just about anything?” Later on, “Borland Turbo Pascal” became very popular because it was even more powerful, and it was much faster because it was a compiler rather than an interpreter. Now you can use Perl to do “just about anything,” and it’s a free program! Perl is also very fast because it’s a compiler, but it has the advantages of an interpreter in that you don’t have to bother with any intermediate files. (No more .obj files, .tsd files or space hungry .exe files to contend with!) It compiles the source code in a “wink of the eye” at run time!
These instructions assume that “Uniform Server” has already been installed (See http://LLBest.com/TestingPHPWebPagesOffline.htm). If it is not installed, or if you want a more complete version of Perl, then skip to ALTERNATE METHOD below. They also assume that the extensions for known file types are not hidden. (1. Double click “My Documents.” 2. Click “Tools / Folder Options….” 3. Click the “View” tab. 4. Make sure that “Hide extensions for known file types” is unchecked.)
1. Create a new text file called “New Text Document.txt” by right clicking on your computer’s desktop, and selecting “New / Text Document.”
2. Double-click the “New Text Document.txt” icon to open it in Notepad.
3. Copy/paste the following into the newly created file, and click “File / Save”:
#!perl -w print "\nHello World!\n"; print "\nHit <Enter> to close window...";<>; |
4. Rename “New Text Document.txt” to “HelloWorld.pl” by right clicking on the icon and selecting “Rename.”
5. Double-click the newly created “HelloWorld.pl” icon.
6. When the “Open with…” dialog box opens, make sure that “Always use this program to open these files” is checked.
7. Click “Other….”
8. Using the hard drive placement of “Uniform Server” from http://LLBest.com/TestingPHPWebPagesOffline.htm as an example, navigate to the “My Documents / Installed / Uniform Server / udrive / usr / bin” folder and double click “perl.exe.”
9. Click “OK.”
10. Double-click the “HelloWorld.pl” icon, and a DOS window containing “Hello world!” should appear.
11. Try entering your own Perl program in place of the “print "\nHello World!\n";” statement. (See http://perldoc.perl.org/ for complete Perl programming documentation.)
ALTERNATE METHOD
Note: “ActivePerl” is a much more complete version of Perl than the version that comes with “Uniform Server.”
1. Go to http://www.activestate.com/Products/ActivePerl/ and click “Get ActivePerl.” (At the bottom of the web page.)
2. Download “ActivePerl.”
3. Install “ActivePerl” in the folder “C:/Perl.”
4. Create a text file named “New Text Document.txt” anywhere on your hard drive, by right clicking and selecting “New / Text Document.”
5. Double-click the “New Text Document” icon to open it in Notepad.
6. Copy / paste the following text into “New Text Document.txt”:
@echo off if "%OS%" == "Windows_NT" goto WinNT C:\Perl\bin\perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9 goto endofperl :WinNT C:\Perl\bin\perl -x -S %0 %* if NOT "%COMSpEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl if %errorlevel% == 9009 echo You do not have perl in your PATH. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul goto endofperl #!perl -w #line 12 # Begin Perl code # print"\nHello world!\n\n"; # End of Perl code # __END__ :endofperl pause |
…or, if you’re using an older version of Windows such as Windows 98SE or Windows ME, then you may copy/paste the following simplified version instead:
@echo off C:\Perl\bin\perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9 goto endofperl #!perl -w # Begin Perl code # print"\nHello world!\n"; # End of Perl code # __END__ :endofperl |
7. Rename “New Text Document.txt” to “HelloWorld.bat.” (Only works if you have Windows set to display the file name extensions.)
8. Double-click the “HelloWorld.bat” icon.
9. Click “File / Save.”
10. Double-click the “HelloWorld.bat” icon, and a DOS window containing “Hello world!” should appear.
| Home | THIS WEB PAGE URL: http://LLBest.com/PerlProgramming.htm |