Write a script to reverse a string without using Perl's
built in function

Answer Posted / pallavi w

#!/usr/bin/perl -w
2
3 use strict;
4 my $string = "STRING";
5 my $rev_string = join "", reverse (split ("", $string));
6
7 print "The String is ". $string ."\n";
8 print "The reverse string is ". $rev_string ."\n";

Is This Answer Correct ?    4 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the function of Return Value?

740


What is a perl references?

672


Explain string comparison operators in perl.

760


In Perl, there are some arguments that are used frequently. What are that arguments and what do they mean?

685


Perl regular expressions are greedy" what does this mean?

666


What are the benefits of perl in using it as a web-based application?

658


What is an interpolation in perl?

747


Why Perl aliases are considered to be faster than references?

723


What is the difference between die and exit in perl?

738


What is the importance of perl warnings? How do you turn them on?

750


How do I debug a perl program?

718


There is no strict data types in perl unlike in other high level languages like Java so wouldn't that be a problem if a code in perl is to be a written by a big team of 20+ members ?"

2177


What is Perl?

755


How do you set environment variables in perl?

731


Which of these is a difference between Perl and C++ ?

746