|Problems? Is your data what you think it is?|
Re^5: Sort alphabetically from fileby james28909 (Deacon)
|on Jun 15, 2019 at 11:19 UTC||Need Help??|
Also, if your on Windows like me, I open($file, '<', shift) or die "$!"; and then immediately binmode($file);.
Commands or parameters or filenames added to the command line when calling the script get put into an array called @ARGV and when you call shift it increments $ARGV to $ARGV to $ARGV and so on for each shift used.
So, if you used C:\path\to\script\perl my_script.pl file_1.txt outfile.txt then you could use shift again to open() (use three arg open) and instead of printing it to the console window, you can write the output to $outFile.
Also, please note this also removes one space from each column per row. As long as that does not corrupt your data set it should be fine. It actually may save you some hard drive space. :)
EDITED: fixed typo in matching patterns, thanks haukex
EDITED: changed and made obvious that the individual needs to make absolutely certain that this does not corrupt anything in their data set.
EDITED: had to add a new paragraph so my second EDIT looked ok.