in reply to Re: array manipulation with string
in thread array manipulation with string

Hmmm ,

The OP would like the existing IP address prefixed with i.e. not replaced by, the string 'IP_', viz:

s/^/IP_/ for values %{ $newHosts->{ server } };
or
$_ = q/IP_/ . $_ for values %{ $newHosts->{ server } };
A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^3: array manipulation with string
by johngg (Canon) on Sep 24, 2009 at 11:05 UTC

    jwkrahn's code is not doing a replacement because his pattern is inside a zero-width positive look-ahead assertion, i.e. it is in effect doing an insertion at a point in the string that is followed by the pattern because the item being substituted is zero-width.

    Cheers,

    JohnGG

      ...which just goes to show how apposite my sig is ;-)

      .oO(I should've TIAS !!)

      Many thanx johngg for the enlightenment - self-evidently jwkrahn is a big fan of unnecessary typing :-D

      A user level that continues to overstate my experience :-))