#!/usr/bin/perl -w use strict; use Filter::Handle qw/subs/; Filter \*STDOUT, sub { local $_ = "@_"; s/blue/red/g; $_ }; print "My house is blue.\n"; print "So is my cat, whose nose is blue.\n"; UnFilter \*STDOUT; print "And the plane is also blue.\n"; #### sub PRINT { my $self = shift; my $fh = *{ $self->{fh} }; print $fh, $self->{output}->(@_); } #### sub PRINT { my $self = shift; my $fh = *{ $self->{fh} }; CORE::print $fh $self->{output}->(@_); } #### use subs qw(print printf);