package ReadOneWriteOtherone; use strict; use warnings; sub TIEHANDLE { my( $self, $in, $out ) = @_; $self = bless { in => $in, out => $out}, $self; return $self; } sub PRINT { my $self = shift; $self = $self->{out}; print $self @_; } sub READLINE { my $self = shift; $self = $self->{in}; readline $self; } sub CLOSE { my $self = shift; close $self->{in}; close $self->{out}; } 1; package main; unless( caller ){ tie *BLOG => ReadOneWriteOtherone => \*STDIN, \*STDOUT or die "Couldn't tie BLOG : $!"; print tied(*BLOG),$/; print tied(*BLOG)->{in},$/; print tied(*BLOG)->{out},$/; print "Enter some input buddy and hit enter : $/"; print BLOG "You entered: ", scalar ; } __END__ $$ perl ReadOneWriteOtherone.pm ReadOneWriteOtherone=HASH(0x1abf1a4) GLOB(0x1ab7f34) GLOB(0x1ab5054) Enter some input buddy and hit enter : Hi there You entered: Hi there