Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6070825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:58:39+00:00 2026-05-23T09:58:39+00:00

print reverse <>; print sort <>; What’s the exact steps perl handles with these

  • 0
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…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:58:39+00:00Added an answer on May 23, 2026 at 9:58 am
     print reverse <>;
    

    <> 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).

    reverse then 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.

    print then prints the array.

    From your notes, you might want something like this:

    perl -e 'sub BEGIN { @ARGV=reverse @ARGV; } print <>;' /etc/motd /etc/passwd
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anybody knows how to print single-linked list in reverse order (one pass and a
In my perl progarm i have the following code: @alpha=('toM','jERRy','mickeY','MARio'); print sort{$a cmp $b}
I have a view in a Django 1.4 project: def index(request): print reverse('menus_index') latest_menu_list
How to print the reverse of the String java is object orientated language without
The following one liner prints out the content of the file in reverse $
print "@_\n"; 4109 4121 6823 12967 12971 14003 20186 How do I sort it
I have used this code to print an English NSString in reverse order: NSString
How would I change this loop to print prime number in reverse... starting from
NoReverseMatch at /natrium/script/4c55be7f74312bfd435e4f672e83f44374a046a6aa08729aad6b0b1ab84a8274/ Reverse for 'run_details' with arguments '()' and keyword arguments '{'script_text': u'print
I'm trying to convert the variable $num into its reverse byte order and print

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.