unlink("PSInfo/PSInfo.csv"); system("PSInfo/PSInfo.exe /LEID_$leg_id"); open $psinfo_file , "PSInfo/PSInfo.csv"; my $psinfo_line; while($psinfo_line = <$psinfo_file>) { print $psinfo_line; } close $psinfo_file; print "$z...$leg_id\n";