unclear about why this happens

This is part of the script
:local RemoteIP [ :resolve “my.dynamichostname.com” ]
:for i from=( [:len $RemoteIP] - 1) to=0 do={
:if ( [:pick $RemoteIP $i] = “/”) do={
:local RemoteIP [:pick $RemoteIP 0 $i]
}
}

:put $adslip
:for i from=( [:len $adslip] - 1) to=0 do={
:if ( [ :pick $adslip $i ] = “/”) do={
:put [ :pick $adslip 0 $i ]
:local adslip [ :pick $adslip 0 $i ]
:put $adslip
}
}
:put $adslip



First loop succesfully strips ‘/32’ from the IP, but the second results with
93.141.38.143/32
93.141.38.143
255.255.255.2
93.141.38.143/32


Does anyone see the error?

Anyone?

I changed the script to:

:local RemoteIP [ :resolve “my.dynamichostname.com” ]
:for i from=( [:len $RemoteIP] - 1) to=0 do={
:if ( [:pick $RemoteIP $i] = “/”) do={
:local RemoteIP [:pick $RemoteIP 0 $i]
}
}

:local LocalIP [ :resolve “my.otherdynamichostname.com” ]
:for i from=( [:len $LocalIP] - 1) to=0 do={
:if ( [:pick $LocalIP $i] = “/”) do={
:local LocalIP [:pick $LocalIP 0 $i]
}
}

/system logging action set remote=$RemoteIP src-address=$LocalIP [ find name=“remoteZ15” ]

And now it works as it should. Does anyone know why this happens?