CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
calling another script :system()

 



laveena
Novice

Sep 5, 2006, 11:44 PM

Post #1 of 4 (403 views)
calling another script :system() Can't Post

Hello ,
I am having a Problem in calling another Script and i do not know where exactly the problem is .
I have Two scrips :
file.pl and system.pl

#!/usr/bin/perl
use strict;
use warnings;

# initialise
my %diff ;
my %diff1 ;
my %diff2 ;


my ($filename1, $filename2) = @ARGV;

@ARGV=2 or die "Usage : There should be 2 arguments";

open my $txt1,"< $filename1" or die "cant open '$filename1' for reading $!";
open my $txt2,"< $filename2" or die "Cant open '$filename2' for reading $!";
open my $txt3,"> added.txt" or die "cant open added.txt for reading $!";
open my $txt4,"> deleted.txt"or die "Cant open deleted.txt for reading $!";
open my $txt5,"> common.txt" or die "cant open common.txt for reading $!";



# create a hash table
while (<$txt2>)
{
$diff{strip($_)} = 1;
}

# extract added/deleted values

while(<$txt1>)
{
print $txt3 $_ unless (check_content($_) || !(eliminate(strip($_))));
}

close $txt1;
close $txt2;
close $txt3;

# extract added/deleted values

open my $txt8,"<".$filename1 or die "cant open $filename1 for reading $!";
open my $txt9,"<".$filename2 or die "Cant open $filename2 for reading $!";

while (<$txt8>)
{
$diff1{strip($_)} = 1;
}

while(<$txt9>)
{
print $txt4 $_ unless (check_content1($_) || !(eliminate(strip($_))));
}


close $txt8;
close $txt9;
close $txt4;


System.pl
#!/usr/bin/perl
use strict;
use warnings;
system('file.pl','update_060904.txt','update_060905.txt')

The Program file.pl works out fine when it is executed seperately.However when it is called through another script i get an error saying
Cant exec "file.pl" : No such file or directory at system.pl,line 6 (which is :system('file.pl','update_060904.txt','update_060905.txt'))

Note : file.pl is only a part of the program .

would be gratefull for any advice

Laveena


d1zz13
User

Sep 6, 2006, 1:41 AM

Post #2 of 4 (400 views)
Re: [laveena] calling another script :system() [In reply to] Can't Post

First of all, make sure that file.pl is in the same directory as system.pl and that it has the correct permissions. This is normally what that message means.

Regards
Rich

If it aint broke then don't try to fix it


laveena
Novice

Sep 6, 2006, 6:07 AM

Post #3 of 4 (396 views)
Re: [laveena] calling another script :system() [In reply to] Can't Post

Hello ,

All of these files are found under the same directory and to each are the permissions 755



laveena


laveena
Novice

Sep 7, 2006, 12:27 AM

Post #4 of 4 (392 views)
Re: [laveena] calling another script :system() [In reply to] Can't Post

hello,

it works now perfectly fine. i specified the whole absolute path

thans again

laveena

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives