Monks, After total defeat, I come asking for assistance to this in my view (which is probably simple) difficult problem. I am attempting to grab the output of a system command, and based on the output, I am attempting to execute a system command on that output. I am attempting to increment the output and delete the drives based on that output. I will show an example of the output of the system command and the code. Third, I will list the errors associated from the code. Thanks--
C:\scripts\NT>tpconfig -l Device Robot Drive Robot Drive Device Type Num Index Type DrNum Status Comment Name Path robot 0 - TLD - - - - \\.\Scsi6 +: drive - 0 dlt 1 UP - Drive0-1 \\.\Tape0 drive - 1 dlt 2 UP - Drive0-2 \\.\Tape1 drive - 2 dlt 3 UP - Drive0-3 \\.\Tape2 drive - 3 dlt 4 UP - Drive0-4 \\.\Tape3 drive - 4 dlt 5 UP - Drive0-5 \\.\Tape4 drive - 5 dlt 6 UP - Drive0-6 \\.\Tape5 drive - 6 dlt 7 UP - Drive0-7 \\.\Tape6 drive - 7 dlt 8 UP - Drive0-8 \\.\Tape7 drive - 8 dlt 9 UP - Drive0-9 \\.\Tape8 drive - 9 dlt 10 UP - Drive0-10 \\.\Tape9 drive - 10 dlt 11 UP - Drive0-11 \\.\Tape1 +0 drive - 11 dlt 12 UP - Drive0-12 \\.\Tape1 +1 drive - 12 dlt 13 UP - Drive0-13 \\.\Tape1 +2 drive - 13 dlt 14 UP - Drive0-14 \\.\Tape1 +3 drive - 14 dlt 15 UP - Drive0-15 \\.\Tape1 +4 drive - 15 dlt 16 UP - Drive0-16 \\.\Tape1 +5 robot 1 - TLD - - - - \\.\Scsi7 +: drive - 16 dlt 17 UP - Drive1-0 \\.\Tape1 +6 drive - 17 dlt 18 UP - Drive1-1 \\.\Tape1 +7 drive - 18 dlt 19 UP - Drive1-2 \\.\Tape1 +8 drive - 19 dlt 20 UP - Drive1-3 \\.\Tape1 +9 drive - 20 dlt 21 UP - Drive1-4 \\.\Tape2 +0 drive - 21 dlt 22 UP - Drive1-5 \\.\Tape2 +1 drive - 22 dlt 23 UP - Drive1-6 \\.\Tape2 +2 drive - 23 dlt 24 UP - Drive1-7 \\.\Tape2 +3 drive - 24 dlt 25 UP - Drive1-8 \\.\Tape2 +4 drive - 25 dlt 26 UP - Drive1-9 \\.\Tape2 +5 drive - 26 dlt 27 UP - Drive1-10 \\.\Tape2 +6 drive - 27 dlt 28 UP - Drive1-11 \\.\Tape2 +7 drive - 28 dlt 29 UP - Drive1-12 \\.\Tape2 +8 drive - 29 dlt 30 UP - Drive1-13 \\.\Tape2 +9 drive - 30 dlt 31 UP - Drive1-14 \\.\Tape3 +0 drive - 31 dlt 32 UP - Drive1-15 \\.\Tape3 +1 #### CODE ##### use strict; my $drive; my $count = -1; open( LIST, "tpconfig -l|" ) or die $!; while(<LIST>) { ($drive) = unpack '@0 A8',$_; ++$count if m/^drive/; system("tpconfig -delete -drive -index ${count}"); } #### ERRORS ######### Cannot delete drive index 0 Cannot delete drive index 0 Cannot delete drive index 17 Cannot delete drive index 32

In reply to RE: RE: Increment by raj8
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.