in reply to Overriding built-ins
Not all core functions can be overridden. print is one of those that cannot.
Even the following doesn't work
package MyPrint; sub print { shift; CORE::print("[\n"); CORE::print(@_); CORE::print("]\n"); } package main; bless *STDOUT{IO}, 'MyPrint'; print("Hello World!\n"); # builtin print STDOUT ("Hello World!\n"); # builtin
but this does
STDOUT->print("Hello World!\n"); # custom
I think tieing also works.
|
|---|