It works for me.
split.pl
$bar=$ARGV[0];
$lak=`$bar`;
print "$lak";
PHP file
<?php
$foo="ls";
$cmd="perl split.pl $foo";
$out=`$cmd`;
print "$out";
?>
Now the $out has the ls output.
I think I understood your question. If not clarify me.
| [reply] [d/l] [select] |
actually, in the php file, $foo="ID_106", its a string which has to be used in the system command. Example:
$foo="ID_106";
system("perl split.pl $foo");
now, the $foo variable is passed to the perl program. the variable $foo is used for system command in perl. example:
$bar=$ARGV[0]; (the argument input, so now $bar="ID_106")
$var=system("grep -A 1 $bar *.txt");
print $var;
Over here, $var doesnt work :( | [reply] [d/l] [select] |
well, that reply is from me.
| [reply] |
I assume Over here, $var doesnt work means $var has nothing in it.
Did you tried printing the $var to a file?
When you said print $var, it prints the contents to the STDOUT, which is captured by the system function in PHP. So print $var seems not printing anything, but actually it has the output.
$bar=$ARGV[0];
$lak=system($bar);
print $lak; #This will be captured by the system function in the PHP f
+ile.
open FH,">> llll";
print FH $lak;
Now the file will also have the output
| [reply] [d/l] |