in reply to map question

This saves having to use temporary variables within the loop, and does the same job.
use strict; my $str = 'test number '; my @newArray = map { $str . $_ } 4 .. 6;

HTH

broquaint

Replies are listed 'Best First'.
Re: Re: map question
by dragonchild (Archbishop) on Mar 19, 2002 at 16:41 UTC
    True, but it doesn't answer the exact question as stated. *grins* It's also the way I would've done it had I been coding that problem.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Re: Re: map question
by hotshot (Prior) on Mar 19, 2002 at 16:42 UTC
    That's only works if the digit I want to replace is the last character in the string, I guess my example wasn't good enough, I should have mentioned that

    Thanks.

    Hotshot