Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

tie

Binds a variable to an object class, enabling magical access through method dispatch.

Associates a variable with a class by calling the class’s TIEHASH, TIEARRAY, TIESCALAR, or TIEHANDLE constructor. After tying, all accesses to the variable are redirected through FETCH/STORE/etc. methods on the tie object. Returns the tie object on success.

Implementation status: Stub. Returns undef (simulating a graceful failure) because full tie support requires deep integration with the value layer to intercept variable access.

Synopsis

tie my %hash, 'DB_File', 'filename';
tie my @array, 'Tie::File', 'data.txt';
tie my $scalar, 'Tie::StdScalar';
my $obj = tie %hash, 'MyTieClass', @args;

See Also

tied, untie