join() in print()

Answer

print @lines may yield unexpected results when you mess around with the output record separator $, that is inserted in between each list item.

Maybe Dan just wanted to be sure this won't happen (especially inside a module it's often a wise thing not to rely on defaults too heavily).

Just imagine a module a.pm that provides method b looking like

package a;
sub b { print @_ }

which is expected to print the given list items concatenated.

If you call it with code like

use a;
{
  local $, = "anoddseparator";
  a::b(1,2,3);
}

then your output will be 1anoddseparator2anoddseparator3 instead of 123.

Next