I need help with my perl code. I need to be able to read in a file with one word on each line and at minimum 50 lines. I have a code to print each line from the file but how do I take these items sort them and then out put to a new file.
while(<>){
chomp;
print "$_ :is in the file";
}
I am struggling to figure out how to take in a file and (I think the <> parses the files line by line) out put it to another file.
For a more functional approach, as a one-liner:
This
prints asorted version ofmapping each line throughchomp, separated ($,) by newlines.As a standalone script which writes to a predetermined file: