I need your help. I'm trying to write a Perl script which will get me the disk free space information in a solaris machine. But I'm stuck. Basically i would like to know the way for adding a particular variable cumulatively in a foreach loop. Below given is the portion of my code (full program attached in as file), where in a foreach loop, I'm matching some pattern from prtvtoc output of each disk and trying to extract a value in a variable $sect_cnt and then i want to do a cumulative addition of this variable, by which i can find the number of free sector available in the disk. Could you please help me in this?
if($_ =~ m/^[^\*]/)
($somethg, $slce, $tag, $flags, $first_sect, $sect_cnt, $Lst_sect, $mntdir)=split /\s+/, $_;
print "$dsknum[$i]:$_", "\n";
print $sect_cnt += $sect_cnt, "\n";