in reply to efficient Array printing to a file

print takes a list, so there's no need to loop. You can take advantage of $", the list separator,

{ local $" = ' '; open my $lgh, '>>', $log or die $!; print $lgh "@x", $/ or die $!; close $lgh or die $!; }
You could equally well set the output record separator $, to space and leave off the doublequotes.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: efficient Array printing to a file
by rjray (Chaplain) on May 27, 2004 at 23:23 UTC

    Unless he's altered $" elsewhere (and I doubt it, because if he were familiar with $" I believe he'd have answered his own question already), there's no need to set it. It defaults to a single space.

    Also, there is no need to explicitly use $/, either. If he wants line-ending, he can just use "\n", which Does The Right Thing on non-UNIX platforms.

    --rjray