9

New to using sublime text 2 and I'm wondering how to get it to point to the activeperl.exe (on win7).

I'm testing out the compiler to make sure it works with something simple like:

$x = 1;
$print "$x";

But it gives me guff about how $x isn't a recognized syntax. I did point ST2 to my python executable, but I forgot which file in the labyrinth I was supposed to edit the path to.

AI52487963
  • 1,137
  • 2
  • 12
  • 28

2 Answers2

29

This worked for me, taken from: http://www.perlmonks.org/?node_id=935014

  1. Click "Preferences -> Browse Packages"
  2. Navigate to the "Perl" subfolder
  3. Create a file called "Perl.sublime-build" with the following content:
    {
      "cmd": ["perl", "-w", "$file"],
      "file_regex": ".* at (.*) line ([0-9]*)",
      "selector": "source.perl"
    }
  1. Manually set the build system by clicking "Tools -> Build System -> Perl"
  2. You can now run your Perl script by mashing Ctrl+B

I am running this version of ActiveState Perl:

C:\>perl --version
Binary build 1402 [295342] provided by ActiveState http://www.ActiveState.com
Built Oct  7 2011 15:49:44
Emma
  • 1
  • 9
  • 28
  • 53
nik
  • 485
  • 5
  • 11
  • 4
    I did this a little differently. I created the "Perl.sublime-build" file by choosing "Tools -> Build System -> New Build System" and then used the content from step 3 there. It works fine on my Mac running OS X 10.7.5. – Alan W. Smith Nov 08 '12 at 20:44
  • Worked great - but how can you set the verbosity level? It is printing out a lot more in the console that I would like to see... – cwd Apr 08 '13 at 16:39
  • Remember to remove .txt extension from the file and works like a charm. – garg10may Feb 10 '15 at 00:31
  • Work like a charm, but somethime no response result, modify any word in pl file and rebuild you will got it. – Chris Ho Oct 21 '17 at 15:18
0

I use the version 3 of Sublime Text and to run perl programs in this editor, you should:

  1. Click "Preferences -> Browse Packages"
  2. Navigate to the "Sublime Text" subfolder library "Lib"
  3. Create a file called Perl.sublime-build with the following content:
{
  "cmd": ["perl", "-w", "$file"],
  "file_regex": ".* at (.) line ([0-9])",
  "selector": "source.perl"
}
  1. Manually set the build system by clicking "Tools -> Build System -> Perl"
  2. You can now run your Perl script by pressing Ctrl+B.

Attention: the file Perl.sublime-build should be created in this root diretory: \Sublime Text 3\Lib.

juzraai
  • 4,835
  • 8
  • 26
  • 41