in reply to Re^3: Saving an array to a disk file
in thread Saving an array to a disk file

Hard to be sure. The join generates a large string that is output as one large write (maybe). The foreach (possibly) generates a large number of small writes. For file I/O one large write (the join) generally is much better than a large number of smaller writes (the foreach).

On the other hand, if the string gets so large it starts swapping out to disk, then the join is likely to be much worse.

And how 'bout good 'ol ($\,$,)?!?