#!/usr/bin/perl
print ("Print the names of a few planets:\n");
print ("Press Ctrl D when done: \n");
@input = <STDIN>;
@input = reverse (sort (@input));
print ("\n\nThe lines arranged in alphabetical order would be: \n");
print (@input);
print ("\n\n");
Execution
Print the names of a few planets:
Press Ctrl D when done:
mars
saturn
jupiter
earth
uranus
pluto
neptune
venus
mercury
The lines arranged in alphabetical order would be:
venus
uranus
saturn
pluto
neptune
mercury
mars
jupiter
earth
No comments:
Post a Comment