⭐ in reply to How can I start incrementing an index at 0?
Next the long answer. Your code is not good for a variety of reasons, most of which you learn from practice and experience, which if you hang out here you will gain quickly. Try this:
This code can still made better, but that should get you off to a good start.use strict; # always. my $drive; my $count = -1; open( LIST, "list -l|" ) or die $!; while(<LIST>) { ($drive) = unpack '@0 A3',$_; ++$count if m/Drive/; system("list -delete -dr -index ${count}"); }
|
|---|