[RESOLVED] Capture Value from System Command in Perl
I'm new to the whole Perl, Unix, PHP thing, so bear with me, please.
Using the below code i'm basically trying to find the size of the file and store that value into $sret. However, it doesn't seem to be working. What am I doing wrong?
$sret = system("wc -c $path/GA_1_"."$fcnt.txt");
Re: Capture Value from System Command in Perl
Found some online sources that said to use the backtick to get the return value, but I still couldn't get it to work. However, I cam across another solution.
@arr = stat "$path/GA_1_"."$fcnt.txt";
$n_bytes=$arr[7];
print "n_bytes is $n_bytes";
This returns the size of the file 1 byte into $n_bytes indicating to me that the file is blank.
Now, I can run the next line of code that drops the file now that I know it is empty.