in reply to int to ascii

No, since Perl is not a strongly typed language! :)

What you have to do, though, is first convert the character 'a' into its ASCII value, using the ord() function. Then you can add your integer to the resulting value, and to obtain the character again, you use the chr function.

Here's a sample:

$first = ord("a"); for (my $x=0; $x < 10; $x++) { print chr($first+$x). " "; }


That will print :
a b c d e f g h i j

Hope it helps...

Replies are listed 'Best First'.
Re: Re: int to ascii
by merlyn (Sage) on May 08, 2001 at 18:26 UTC
    No, since Perl is not a strongly typed language! :)
    Hey, watch that. Larry has said that Perl can either be considered a very weakly typed language or an extremely strongly typed language with only a few datatypes: scalars, arrays, hashes, and filehandles. I tend to lean towards the latter, but both are accurate, but it's not accurate to say only the first.

    -- Randal L. Schwartz, Perl hacker