---
title: "Perl in node.js"
description: "Yes! Perl5 can be embedded in node.js! First of all just do a npm install perl P.S : node-perl requires a perl5 binary built."
url: "https://h3manth.com/scribe/perl-nodejs/"
canonical_url: "https://h3manth.com/scribe/perl-nodejs/"
markdown_url: "https://h3manth.com/scribe/blog/perl-nodejs.md"
publishDate: "2012-09-11T00:00:00.000Z"
author: "Hemanth HM"
category: "javascript"
tags: ["nodejs","javascript","git"]
word_count: 148
reading_time_minutes: 1
x_markdown_tokens: 375
content_signal: "ai-train=yes, search=yes, ai-input=yes"
---

# Perl in node.js

> Yes! Perl5 can be embedded in node.js! First of all just do a npm install perl P.S : node-perl requires a perl5 binary built.

Yes! Perl5 can be embedded in node.js! First of all just do a `npm install perl`

P.S : node-perl requires a perl5 binary built with -fPIC and -Duseshrplib

This is synchronous but useful embedded Perl5 for node.js

If you want to try any version of perl, you must check out perl-node.

```

# >git clone git://github.com/hideo55/node-perl.git

# >cd node-perl

# >node-waf configure

# >node-waf build

# >node-waf install

```

And then :

` var Perl = require('perl').Perl(); var perl = new Perl();`

perl.Run({
    
    
    opts : ["-Mfeature=say","-e","say 'Hello world'"]
    

}, function(out,err){
    
    
    console.log(out);
    

});

perl.Run({
    
    
    script : 'example.pl',
    args : ['foo', 'bar']
    

}); 

If you opted for Perl5 :

```javascript
 var Perl = require('perl-simple').Perl; var perl = new Perl(); var ret = perl.evaluate("reverse 'yoeman'"); console.log(ret); // => nameoy
```

var Perl = require('../index.js').Perl; var perl = new Perl(); perl.use('LWP::UserAgent'); var ua = perl.getClass('LWP::UserAgent').new(); var res = ua.get('http://utf-8.jp/'); console.log(res.as_string()); 

Happy Hacking!
