Since you've been trying so often to get help on this task, and you're still not getting it, let's take a step back and look at the whole task, now that you've posted some code that seems to cover everything (or does it?)...
- First, you run an ms-dos batch file (convert.bat). Does this take some data file and convert it into some other data file? Why wouldn't you just do that as part of your perl script? (Um, okay, maybe it's because you don't know Perl that well yet... or maybe convert.bat was provided by DataPro to format their more complex log format; nevermind.)
-
Next, you open and read a text file (newreport.txt). (Is this the one that "convert.bat" created, by any chance?) You capture these single digits from each line and save them to another output file (output.txt).
-
Finally, based on your final question, you want to read each line of output.txt and run a system call that will eject the tape corresponding to the saved digit.
Maybe what you really want, then, is simply to run that last system call while you're reading "newreport.txt" -- this will save you a lot of trouble.
#!/usr/bin/perl -w
use strict;
system ("c:\\Perl\\DataPro\\convert.bat");
open(DPSLOTFILE, "< c:\\Perl\\DataPro\\newreport.txt")
or die "Can't open file: $!";
while ( <DPSLOTFILE> ) {
if ( /MSL6000\s+Trinity\s+(\d+)/ ) {
my $tapeid = $1;
print "Running omnimm to eject $tapeid\n";
system("c:\\Perl\\DataPro\\omnimm -eject \"MSL6000 Trinity\" $ta
+peid -location \"blahblahblah\"");
}
}
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.