Scripting issue between v2.9 and v3.9

:local netw "10.10.10.254/24";
:local intf [/ip address get [find address=$netw] interface];

This works fine under v2.9, but when I tried to execute it on v3.9 it shows error on the second line of code just after ‘address=’

What am I missing?

Thanx, Ivan.

OK, here’s update …

if you substitute :local with :global then everything works. When I try to define local variable it is not shown in :environment print, but all global variables are.

You will find when you get into heavy scripting. Some of the sytax scripting process was changed some in v 3.X So some scripts that worked for 2.9.X mite not work for 3.X. Just in case you didnt know. -Jordan

I suppose you were typing these commands in console, when you do that each line is like one script, but in v3.x local variables are accessable only within one script.

Try to paste this code in console then it should work:

{
  :local netw "10.10.10.254/24";
  :local intf [/ip address get [find address=$netw] interface];
}