in reply to Re: regular expressions and substituting in variables.
in thread regular expressions and substituting in variables.

The line @dn=@s_dn; should moved to just inside the first for loop, so that the original template is restored each time before you do the substitution. Otherwise, as you probably found, no substitutions will occur after the first iteration.

Replies are listed 'Best First'.
Re: Re: Re: regular expressions and substituting in variables.
by Pug (Monk) on Jan 23, 2001 at 02:49 UTC
    Thanks that pointed showed 2 things I'm doing wrong. 1) the restoring. when I put that back I had the same issue on my script but not on the snipit given here the difference is I'm using a reference to an array in the script and so I'm not doing a copy I'm doing a ?pointer? is there anyway to stop that?
      It sounds like you want to do a deep copy, which you can find out about in Creating a copy of an array.

      If your data structure is just one array deep, though, this should be sufficient: $dn = [ @$s_dn ]; which creates a new array with the contents of the array referred to by $dn_sn.