which is equivalent to the Perl code:line += String.fromCharCode(c.charCodeAt(0)+1);
assuming that $c contains just one character, as I believe it does from reading your code. Note that Perl uses a dot rather than a plus sign to concatenate strings. The Perl ord function returns the ord value (0-255) of a character while the Perl chr function does the reverse.$line .= chr(ord($c)+1);
Given your lack of Perl experience, rather than attempting to convert the whole script all at once, I suggest you start by writing a number of very short Perl test programs, liberally sprinkled with print statements, so you can see what is going on. That should slowly build your confidence without overwhelming you. For example, you could start by running this little test program:
which should print:use strict; use warnings; my $line = "hello"; my $c = "A"; print "1. line='$line' c='$c'\n"; $line .= chr(ord($c)+1); print "2. line='$line' c='$c'\n";
Always start your Perl scripts with "use strict" and "use warnings" as shown above. Doing that will catch a lot of errors for you.1. line='hello' c='A' 2. line='helloB' c='A'
As for learning Perl, take a look at learn.perl.org and Perl Tutorial Hub. Also, be sure to refer to the Perl online documentation. Good luck!