#!/usr/bin/perl
print ("Enter a statement of your choice:\n");
print ("Press Ctrl D when you are done:\n");
while (<STDIN>)
{
chop;
$new = reverse($_);
print ("The statement printed in reverse is: ");
print($new, "\n");
}
Execution
Enter a statement of your choice:
Press Ctrl D when you are done:
abc def ghi jkl mno pqr stu vwx yz
The statement printed in reverse is: zy xwv uts rqp onm lkj ihg fed cba
Enter a statement of your choice:
Press Ctrl D when you are done:
RATS LIVE ON NO EVIL STAR
The statement printed in reverse is: RATS LIVE ON NO EVIL STAR
Enter a statement of your choice:
Press Ctrl D when you are done:
Anybody here who is not confused does not know what is going on.
The statement printed in reverse is: .no gniog si tahw wonk ton seod desufnoc ton si ohw ereh ydobynA
No comments:
Post a Comment