I am executing a unix command through perl script to get size of a direcory.
$path = "/dir1/di2/";
system("du -sh $path");
How can I get the result back in my perl script.
I am using
$size = system("du -sh $path");
print $size
But it is giving size=0;
a
systemcall returns the status of the call, not the output. Use backticks (or theqxoperator) like: