Change MAC by script from the array

I have two scripts, the first one is loading MACs from the text file to the array variable “MACs” and select random “CurrentMAC” index. It’s works fine.

Second script should apply these settings to the interface but it won’t work:
:global MACs
:global CurrentMAC
/interface wireless set vwlan1 mac-address=[:pick $MACs $CurrentMAC]If I put /log info [:pick $MACs $CurrentMAC] instead of the last line in the script it post to the log correct MAC in a form of “12:34:56:78:9A:BC”. If I copy this value & put to the script it works too:
/interface wireless set vwlan1 mac-address=12:34:56:78:9A:BCPlease, point me to my mistake.

Perhaps if you first store the result into a local variable, and then use the variable directly, e.g.
:local selectedMac [:pick $MACs $CurrentMAC];
/interface wireless set vwlan1 mac-address=$selectedMac

Thank you, I’ve tried your script & it won’t work too. But it helps me to find the root of the problem — my parser’s code was lame & include “cr” symbol for the every record.