use strict; use warnings; { package TiedObject; sub TIESCALAR { my $sClass = shift; return bless([ @_ ], $sClass); } sub STORE {} sub FETCH { shift->[0]; } } my $sErr; tie $sErr, 'TiedObject', 5, "More data"; printTiedObject($sErr); sub printTiedObject { my $oErr = tied($_[0]); #does not copy scalar, prints out "...is tied to..." print "using \@_ directly\n"; if (defined($oErr)) { print "\$_[0] is tied to <$oErr>\n"; } else { print "\$_[0] is not tied"; } #copies scalar, prints out "..is not tied" print "\nafter \$param0 = shift \@_\n"; my $param0 = shift @_; $oErr = tied ($param0); if (defined($oErr)) { print "\$param0 is tied to <$oErr>\n"; } else { print "\$param0 is not tied\n"; } } #### using @_ directly $_[0] is tied to after $param0 = shift @_ $param0 is not tied