in reply to how to splice an array?
Maybe it's just me, but this doesn't seem to make any sense - you are putting your string into the first element of your array, but nothing into subsequent elements - why not just use a scalar? And what is your splice meant to do?
Then you are creating a new string (just the one) and pushing that into element 0 of another array. Again why not use a scalar?
Are you sure you haven't misunderstood the class assignment? ;)
$scalar="PERLPERBPERCPERD"; $homework = join ' ', $scalar =~ /(.{4})/g; print $homework;
|
|---|