P
Peng Yu
Only the first statement prints the reversed result correctly. I'm
confused why the other three don't print as I expected. How to print
the reversed result without using the intermediate variable $rstring?
$ cat reverse.pl
#!/usr/bin/perl
use warnings;
$string = "abc";
$rstring=reverse($string);
print "$rstring\n";
print reverse($string), "\n";
print(reverse($string), "\n");
print((reverse($string)), "\n");
$ ./reverse.pl
cba
abc
abc
abc
confused why the other three don't print as I expected. How to print
the reversed result without using the intermediate variable $rstring?
$ cat reverse.pl
#!/usr/bin/perl
use warnings;
$string = "abc";
$rstring=reverse($string);
print "$rstring\n";
print reverse($string), "\n";
print(reverse($string), "\n");
print((reverse($string)), "\n");
$ ./reverse.pl
cba
abc
abc
abc