NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
A different solution (Score:1)
This isn’t better, but in the spirit of TMTOWTDI and of the
selectidiom fromperldoc -q unbuffer…Or to do away with the array-copy, assuming you have set up with “
my $log = []” instead:The
\@$construction is there to force Perl to make a new copy of the array reference in$log. That way the first list element is a copy of$loginstead of an alias, and therefore unaffected by the overwriting of$login the next expression.But the
splicesolution is lightyears ahead.Reply to This