in reply to generating a character sequence

printf"%s\n",pack"C*",map{(ord'a')+$_%26}0..$n-1;

Replies are listed 'Best First'.
Re: Re: generating a character sequence
by Hofmator (Curate) on Aug 22, 2001 at 15:01 UTC

    Let me add a short explanation to that. This is a precedence problem, your statement is read as (I only show the map part here): map { ord('a'+$_%26) } 0..$n-1;Both things are added first and then passed to ord - btw, with use warnings you get a warning about 'a' not being numeric in addition ... this should have been sufficient as an explanation ;-)

    So I0's solution works nicely or you can also write map { ord('a')+$_%26 } 0..$n-1; according to the rule: 'What looks like a function, is a function!'

    -- Hofmator