open ( FH , "diskpart rescan|" ) || die ( "Failed to open filehandle.\n" ) ; my @inFile = ; # read all at once into array foreach (@inFile){ print $_."\t"; }