asmodai has asked for the wisdom of the Perl Monks concerning the following question:

Suppose I have an array:

@blah

@blah holds some values like the array it is.

$blah[0] holds "10".

How would I go about adding a string to $blah[0] so that it concatenates to:

"10.0.0.0"?

I've tried funky constructs like:

$blah[0] += ".0.0.0"; Or changed the += to . , but to no avail, since it is not a numeric.

Must be simple, I'm sure. :)

Thanks

--Jeroen/Asmodai

Replies are listed 'Best First'.
Re: How to add content to an array element?
by c-era (Curate) on Feb 22, 2001 at 18:25 UTC
    Try  $blah[0] .= ".0.0.0"; or one of these ways  $blah[0] = $blah[0] . ".0.0.0"; or $blah[0] = "$blah[0].0.0.0";
Re: How to add content to an array element?
by asmodai (Novice) on Feb 22, 2001 at 18:28 UTC

    Thanks for OeufMayo, tilly and I thought mr.nick for pointing me to the obvious:

    $blah[0] .= ".0.0.0";

    --Jeroen/Asmodai

Re: How to add content to an array element?
by tame1 (Pilgrim) on Feb 22, 2001 at 21:31 UTC
    How about
    @blah = qw( 10 0 0 0 ); $string = join '.', @blah;
    now $string should contain '10.0.0.0'

    What does this little button do . .<Click>; "USER HAS SIGNED OFF FOR THE DAY"