sub delete_drives3 { my $drive; $count = -1; open(TPCONFIG,"tpconfig -l|"); while() { ($drive) = unpack '@0 A5',$_; next if /^r/; next if /^D/; next if /^T/; ++$count; print "Deleting drive $count\n"; system("tpconfig -delete -drive -index ${count}"); }; };