my $filepath = "C:\\Source\\files.log"; open (IN, $filepath) || die "Can't open $filepath:$!"; while ( my $line = ) { chomp $line; next if ($line =~ /^\s*$/ or # blank lines $line =~ /^\s*#/); # comments push(@filesaffected, $line); } close IN; for (@filesaffected){ ($dir, $fname)= $_ =~ /^(.*?)[\\\/]([^\\\/]+)$/; chdir $builddir; $ENV{'JAVA_HOME'}="C:\\j2sdk1.4.2"; $ENV{'SSDIR'}="\\\\chinook\\Sourcesafe\\Acme"; exec "ant tate_get_loc -DLocDirName=$dir -DFileName=$fname"; }