S
sree
Hey, can someone tell me the next step:
I wanna compare if one of this string is the reverse of the next,
using the functions- shift and pop. I could manage to print the
strings using 'while' loop.
$str1=<>;
chomp $str1;
@str1= split("", $str1);
while(@str1) {
@pop= pop(@str1);
}
print "\n";
$str2=<>;
chomp $str2;
@str2= split("", $str2);
while(@str2){
@shift= shift(@str2);
}
Now, how to compare these two arrays, to check if one of the array is
the reverse of the other.
I wanna compare if one of this string is the reverse of the next,
using the functions- shift and pop. I could manage to print the
strings using 'while' loop.
$str1=<>;
chomp $str1;
@str1= split("", $str1);
while(@str1) {
@pop= pop(@str1);
}
print "\n";
$str2=<>;
chomp $str2;
@str2= split("", $str2);
while(@str2){
@shift= shift(@str2);
}
Now, how to compare these two arrays, to check if one of the array is
the reverse of the other.