ban
ban

Reputation: 685

Shell Script inside perl script

I have a perl script which is working fine, but then I wanted to add some shell script in it. I tried to google but I don't know the exact word. Is it embedded programming? So this is what I know.

We can write assembly code in a C file like this:

*****
C - code
int a=10;
char *p;
asm {       //here is the secondary or embedded language (assembly code)
assembly code...
ldaa 1;
push;
}

back to C...
print( "this works");

I just want to do something along these lines, but with perl as the main language and shell script being the secondary or embedded language.

Thank you everyone

Upvotes: 0

Views: 133

Answers (1)

Bitwise
Bitwise

Reputation: 7805

Is this what you are looking for?

$exec_string = <<EXEC;
echo this is my shell script
ls > tmp1
ls > tmp2
EXEC

system($exec_string)

EXEC can be substituted by any word (e.g. SHELL, SCRIPT, whatever).

Upvotes: 1

Related Questions