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\"");
}
}