You forgot your closing </code> tag.

use strict; my $drive; my $count = -1; open( LIST, "tpconfig -l|" ) or die $!; while( <LIST> ) # I added the <LIST>... which I suspect you had. { ($drive) = unpack '@0 A8',$_; ++$count if m/^drive/; system("tpconfig -delete -drive -index ${count}"); # You should check all system calls for error. # system will set $? to an error code for you. }
As for your errors... they don't look Perl related. Perhaps there is some other reason that you can't delete a drive... like some process has some kind of lock on a file in the drive.

Update: You can read up on $? here

Another Update: raj8 says the script deletes the drives, but still generates the errors.
The "problem" is that system doesn't capture STDERR. The way to circumvent this is to redirect to nul: BUT BEWARE! This will hide ALL error messages from the system call!
Try this:

system("tpconfig -delete -drive -index ${count} 2>nul:"); die "Unknown Error with tpconfig $count" if $? >> 8;
Also, be sure to read chromatic's post. He raises a good point about when you make the system call, although I suspect that since there are only two robots and four errors that this isn't the complete answer. (Although I would bet good money that it does explain the duplicity of the index 0 error).

In reply to Re: Increment by Adam
in thread Increment by raj8

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.