Perl system function

Perl system function

How can I control from what directory the call to the system will be dome

I want the perl script to call other perl script in other dir
some thing like this:

----/home/a.pl------------------
#!/usr/local/bin/perl
system ("cd /home2/rami");
system ("prel B.pl");

B.pl will work only if is call from
dir /home2/rami

Any other idea how a.pl can call b.pl
are wellcome


Regards,
Rami
addadyAsked:
Who is Participating?
 
dircConnect With a Mentor Commented:
#!/usr/local/bin/perl
system ("cd /home2/rami; perl B.pl");    
0
 
ozoCommented:
#or
chdir '/home2/rami';
system "perl B.pl";
#or
do '/home2/rami/B.pl';
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.