#!/apps/bin/perl use warnings; use strict; #search directory for files ending with .RPT and store the names in an array my @files=glob("*.RPT"); my $i; my $x; #for each file in array open and search for string for $i (@files){ open INPUT, "$i" or die "Couldn't open the file. $!"; open OUTPUT, "> $i\.dat"; print OUTPUT "$i\n"; print OUTPUT "\n Parameter Value\n"; print OUTPUT "-------------------------\n"; while (){ #open file containing expressions to search for open FILE, "params.txt" or die "Couldn't open the file. $!"; my @params=; for $x (@params) { if (/\s$x\s*\d*/){ $x=$&; print OUTPUT "$x\n"; } } } }