i installed active perl in d: and i save my pl file in desktop. how can i run perl file. whenever i run the perl program , the error is Can't open perl script "hello.pl": No such file or directory.. please help me
-
1Have you tried running it from the command prompt?Quick Joe Smith– Quick Joe Smith2010-11-12 11:51:38 +00:00Commented Nov 12, 2010 at 11:51
-
4yes, but have you tried running it from the command prompt, to test that the install works, as opposed to having issues with your local web server?Michael Paulukonis– Michael Paulukonis2010-11-12 12:25:00 +00:00Commented Nov 12, 2010 at 12:25
3 Answers
Your command prompt probably doesn't start pointing at your desktop. Look at the path it gives you ("C:\Users\yourusername>", maybe?). You can either use cd at the terminal to change to the Desktop directory, or move the script to the path where the command prompt starts.
Use dir (Windows) or ls (Linux/Mac) to see what files are in the current directory at the prompt.
2 Comments
What is the first line of your perl script? Try setting it to #!perl
Usually the association of .pl to perl.exe is taken care of for you when you install Activestate Perl or Strawberry Perl.
If this is not the case, you need to associate the .pl extension with the perl.exe program. To do this you can use Windows Explorer (Tools menu, Folder Options, File Types) or you can open a command prompt window and used the assoc and ftype commands - you'll need to find the full path to perl.exe.
If you add the path of perl.exe to %PATH then you can just type perl myscript.pl foo bar
2 Comments
#! line always has meaning to Perl, irrespective of platform. That way it’s not a portability issue, as it would be if it only paid attention to it on some platforms but ignored it on others.Try walking through the following guides, step by step.