use Symbol; use 5.012; { package Foo; sub TIEHANDLE { my ($sClass, $fh) = @_; return bless([$fh], $sClass); } sub PRINT { my $self = shift; my $fh = $self->[0]; CORE::print $fh "tied to $self:", @_; } } my $x=gensym; tie *$x, 'Foo', \*STDOUT; local $\="\n***\n"; say "Not tied: I'm just saying ..."; say $x "I'm just saying ..."; # outputs (note that say $x is followed by "\n***\n" # not "\n" # # Not tied: I'm just saying ... # tied to Foo=ARRAY(0x8197ed0):I'm just saying ... # *** #### This is perl 5, version 12, subversion 1 (v5.12.1) built for MSWin32-x86-multi-thread