To append a character to the beginning of a string in Perl, you can use string concatenation with the `.` operator or the `unshift()` function.
In this example,
$str1
with a value of "ello"
..
operator to prepend the character 'H'
to $str1
.$str1 = "ello";
$str1 = "H" . $str1;
print $str1;
Hello
In this example,
$str2
with a value of "orld"
.unshift()
function to prepend the character 'W'
to $str2
.@str2 = qw(orld);
unshift(@str2, "W");
print @str2;
World
In this tutorial, we learned How to Append a Character to beginning of a String in Perl language with well detailed examples.