Hi Chang Min Jeon,
Please use back stick operator here, instead of system command,
because system command doesn't return anything.
Replace the system command with,
$Result = `$command`;
If ($Result) {
Print " appropriate message \n";
} else {
print " Failed message \n";
}
--
Regards,
Mustafa
________________________________
From: [email protected]
[mailto:[email protected]] On Behalf Of
Chang Min Jeon
Sent: Wednesday, May 13, 2009 5:44 AM
To: [email protected]
Subject: use system() function
hello
I trying to modify file using perl one line like below.
my $cmd = "perl -pi -e's/aaa/bbb/' ";
open(MAKEFILES, '<', $ARGV[0]) or die "file open error";
my @filelist = <MAKEFILES>;
foreach my $file (@filelist) {
chomp($file);
my $command = $cmd.$file;
print $command,"\n";
!system($command) or die "shell command not work";
}
close(MAKEFILES);
but system function does not work.
It print
./Windowset/Common/Makefile.gmk
perl -pi -e's/-+g -+dwarf2//' ./Windowset/Common/Makefile.gmk
: No such file or directory.mmon/Makefile.gmk
./Windowset/Special/Makefile.gmk
perl -pi -e's/-+g -+dwarf2//' ./Windowset/Special/Makefile.gmk
: No such file or directory.cial/Makefile.gmk
someone who meet this problem?
Thanks in advance
--
CashFlow
To be rich.
Please do not print this email unless it is absolutely necessary.
The information contained in this electronic message and any attachments to
this message are intended for the exclusive use of the addressee(s) and may
contain proprietary, confidential or privileged information. If you are not the
intended recipient, you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately and destroy all copies of this message and
any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should
check this email and any attachments for the presence of viruses. The company
accepts no liability for any damage caused by any virus transmitted by this
email.
www.wipro.com
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs