Nik
Nik

Reputation: 201

Shell calling perl and returning back string to Shell Script

I have a shell script , i want to call a perl script to do some compute, once perl is called i want perl to process it and while returning i want it to return not exit code but a string back to shell script ? how can i do that?

Here is my simple piece of code calling perl in shell script VAR=$(perl Test.pl)

Upvotes: 1

Views: 1745

Answers (1)

DeVadder
DeVadder

Reputation: 1404

Quick and dirty would be to have the perl script print the Information to STDOUT and just call it in your Shell script by backticks or just as you did. Along the lines of

VAR=`perl Test.pl`

This will put everything the perl script printed to STDOUT into VAR.

Upvotes: 2

Related Questions