Yary has asked for the wisdom of the Perl Monks concerning the following question:
which prints:my $pick_real_print = 1; use vars qw(&printish); *printish = $pick_real_print ? *CORE::print : sub { print "I'm not really print!\n" }; CORE::print "Here is the real deal\n"; printish "printing\n";
Here is the real deal Undefined subroutine &CORE::print called at - line 7.I know print is a very special function... is it possible to alias to it?
ps. I already have the workaround sub { print } in place. I was hoping to benchmark the difference between that and aliasing via code reference, since this will be in a tight loop, and I'm curious.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Possible to get coderef of CORE::print to alias it?
by LanX (Saint) on Feb 19, 2013 at 00:33 UTC | |
by Yary (Pilgrim) on Feb 19, 2013 at 00:47 UTC |