I tried to split one string and assign an array, and then add http at the start using unshift.
But, I am not getting the desired output. What am I doing wrong here?
use strict;
my $str = 'script.spoken-tutorial.org/index.php/Perl';
my @arr = split (/\//,$str);
print "chekcing the split function:\n @arr\n";
my @newarr = unshift(@arr, 'http://');
print "printing new array: @newarr\n";
the output is:
checking the split function:
script.spoken-tutorial.org index.php Perl
printing new array: 4
Why instead of adding http is it giving number 4 (which is array length)?