if you want to duplicate the array tab1 with all its content you could just say
put tab1 into tab2
tab2 is contains a copy of tab1, both are now arrays with the same content and the same keys. In case tab2 was not used before in the handler it would be created and be an array thereafter because you put an array into it.
if you want to copy content from array tab1 to array tab2 then you could do
put "a" & cr after tab1
put "b" & cr after tab1
put "c" & cr after tab1
put "d" & cr after tab2
put "e" & cr after tab2
put "f" & cr after tab2
split tab1 with cr
split tab2 with cr --It's not the best way but in my case that's what I have
The problem start if you have kes as string of characters, there are the same keys in both arrays and their values are different. You must decide what to do in such case.
Another question, how to I merge to strings ?
I have a table of strings. Each string is between 1 and 4 caracters, and I want them all to be 6 caracters long.
put "agf" & cr after tab1
put "b" & cr after tab1
put "cggg" & cr after tab1
split tab1 with cr
repeat with i = 1 to the number of lines in the keys of tab1
repeat while the number of char of tab[i] is not 6
put "-" after tab1[i]
end repeat
end repeat
it works if you name your array in the second repeat loop correctly (tab1 instead of tab and if you say "the number of chars" instead of "the number of char"
put "agf" & cr after tab1
put "b" & cr after tab1
put "cggg" & cr after tab1
split tab1 with cr
repeat with i = 1 to the number of lines in the keys of tab1
repeat while the number of chars of tab1[i] is not 6
put "-" after tab1[i]
end repeat
end repeat
constant kDashes = "------"
put "agf" & cr after tab1
put "b" & cr after tab1
put "cggg" & cr after tab1
split tab1 with cr
repeat for each key tKey in tab1
put char 1 to 6 of (tab1[tKey] & kDashes) into tab1[tKey]
end repeat
ps.. you have a typo in yours which is way it probably didn't work, the repeat line you refer to tab instead of tab1