[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Need filename wildcard help!



Hey fellow MacPerl users,

I am writing some scripts to track insertions on boards that we test 
PowerPC product on.  I have several that work currently on my Sparc, but 
I'm trying to port some to MacPerl so that I can play with them at home.  
However, I'm having a little trouble getting a wildcard to work for 
filenames.  I imagine this has something to do with the fact that the 
MacOS allows you to use the asterisk symbol in file names.  Here's what I 
want my script to look like:


%allBoards;
$bdCntr = 0;


while($thisSys = </StarmaxHD/dadadada/dadada/dadada/F330*.MONDATA>) {
    open(SYSFILE, $thisSys) or die "Cannot open the $thisSys data file!";
    while(<SYSFILE>) {
			     chop;
			     @newData = split(/\t/);
			     $oneBoard = @newData[12];
			     if($allBoards{$oneBoard}) {
						      $allBoards{$oneBoard} += ($newData[0] + $newData[1]);
			     } else {
						      $allBoards{$oneBoard} = ($newData[0] + $newData[1]);
						      $bdCntr += 1;
			     }
    }
    close(SYSFILE);
}

@sortBoards = sort keys(%allBoards);
foreach (@sortBoards) {
			printf "%-12s %6s\n", $_, $allBoards{$_};
}

print "There were a total of $bdCntr boards found in these files.\n";


It is skipping everything enclosed within the outer loop.  I know this 
because I tested it with some "print" statements to see how far and where 
it was getting.  I also tried using quote marks instead of < and > for 
the path.  I found a temporary fix, but I don't like it.  I've basically 
just loaded all of the "F330*.MONDATA" file names into a text file, and 
then just read them into the routine one by one.  It works, though.  Is 
there a wildcard to be used for file names?  TIA.

Jared