#!perl -w use Win32::Clipboard; my $CLIP = Win32::Clipboard(); print "This gets printed to STDOUT\n"; tie *STDOUT, 'clippy', \$CLIP; print "This will end up into the clipboard."; untie *STDOUT; package clippy; use Tie::Handle; use vars qw(@ISA); @ISA = qw(Tie::Handle); sub TIEHANDLE { my $class = shift; my $clip = shift; return bless({clip => $clip}, $class); } sub PRINT { my $self = shift; ${$self->{clip}}->Set(@_); }