in reply to Programmatic creation of iterated string

In the chatterbox you said
map { $_ .. $_+2 } (1,4,7) is what I mean to put to clarify what you meant to say. You could try: $x = "\n".join "\n", map { join ' ', ( $_ .. $_ + 2 ) } ( 1, 4, 7 ); Is that what you wanted to have?

Replies are listed 'Best First'.
RE: Re: Programmatic creation of iterated string
by merlyn (Sage) on Aug 18, 2000 at 20:34 UTC
    And that's cool code, but it's a lot more typing than just the static string!

    What I tried to get at in the chatter box is that we have only one example to work from, and no rules or specification. We don't know if princepawn wants "any N by N matrix as a text string" or "reshape the numbers 1 through 9 in different orientations". There's nothing "programmatic" about a text string, even as a solitary example.

    Most of the hard work of programming is just getting the specification right. The easy part is the coding!

    -- Randal L. Schwartz, Perl hacker