print reverse <>;
print sort <>;
What’s the exact steps perl handles with these operations?
It seems for the 1st one,perl not just reverses the order of invocation parameters,but also the contents of each file…
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
<>is evaluated in an array context, meaning it “slurps” the file. It reads the entire file. In the case of the magic file represented by the files named in @ARGV, it will read the contents of all files in the order referenced by the command line arguments (@ARGV).reversethen reverses the order of the array, meaning the last line from the last file comes first, and the first line from the last file comes last.printthen prints the array.From your notes, you might want something like this: