A few days ago I already described how to set up the Eclipse development environment for usage with Perl scripts. If you don’t want to use a sledgehammer to crack a nut, you can also use the Notepad++ editor to relatively comfortably write Perl scripts.
Besides syntax highlighting and intellisense aka auto completion, Notepad++ also offers the possibility to execute Perl scripts directly from the editors interface. However, therefore a one-time setup is necessary, which I want you to briefly explain below.
Step 1 – create test scripts:
To be able to check if you have set up everything correctly later, you should definitely first create a small Perl script and save it. Important: Only stored scripts can be executed afterwards. So always save your script before clicking the “Run” button.
Step 2 – preparing the “Run” command:
In the Run dialog you must now specify the path to the Perl.exe on your computer. (The button with the three small dots opens a selection dialog.) Normally the Perl installation is placed directly on C:\ and the Perl.exe is located in a folder called “bin”.
Step 3 – set the “Run” parameter:
Now you have to extend the command by the following parameter:
"$(FULL_CURRENT_PATH)"
Just look at the screenshot above, if you’re not sure how to set the parameter. Without these additional parameters indeed the Perl console would get opened, but our script won’t run.
Step 4 – create a hotkey:
By clicking on the “Save” button you can create a shortcut aka hotkey to run your script.
Step 5 – test your result:
Now everything should work. If you press your hotkey (combination) your script should be executed directly in the console now. As always, If you still have questions, write me a comment.
No products found.
Wow it’s wonderful. Keep update with new blogs.
I like this blog. Thank you for sharing this information.
I know this comment is even freaking older now but I use:
cmd /c C:\Strawberry\perl\bin\perl.exe “$(FULL_CURRENT_PATH)” && pause
after the perl is executed, it leaves CMD window open with the message “‘Press any key to continue…” until (duh) a key is pressed
For some reason, when I cut and pasted, it changed my normal double-quote marks to start and end double quotes (“” vs “”). Needs the normal double-quotes!
Ah, it turns out quotes are automatically replaced when you post.
You need unicode U+0022
OMG — this is endless!!!
Sorry should be:
cmd /k C:\Strawberry\perl\bin\perl.exe “$(FULL_CURRENT_PATH)” && pause
where double quotes above are unicode U+0022 (Shift+2 on many querty keyboards).
Did u try anything different ?
I have tried reopening notepad++ , it shows the same behaviour :(.
Thanks
Have you written a pause statement at the end of your script? It’s normal beaviour, that the consoles closes after your script is completed. So if you wan’t to keep the console open to read your program’s output, you shoudl write a pause statement ( <>; ) at the end. For more information read the first answer over here: http://stackoverflow.com/questions/2513682/how-can-i-pause-the-console-window-in-pl-and-bat-file
Thanks a lot for the info , i have followed the steps , its executing good , but the command console screen is seen only for a short duration , very tough to verify the output.
Please provide the solution to it.
Thanks again
It executes to the console but it immediately closes the console window, making it problematic to verify output
nvm. I reopened notepad++ and it worked fine.
I know this comment is freaking old but I recently had this problem also… perl 2017 everyone.
So I used this command instead:
cmd /k perl $(FULL_CURRENT_PATH)
Of course the perl command has to be included in the %PATH% var already but otherwise this looks like an easy command to me. Specially if you use something like Strawberry to change between different perl versions, this is a flexible way to go.
…and your comment is freaking awesome. Thanks for your input! :-)