in reply to Help with references

I think you mean to return (@a1,@a2); in f(). As it is, you're taking references to them before passing back the list.

A side note, the line where you call f() will leave the global @a2 empty. Arrays in multiple assignment are greedy.

After Compline,
Zaxo