On May 13, anish mehta said: >Pls tell me what are the tied variables in perl. I have tried it to read it >from book but some words from the experts will be quite useful to make >further progress and clarity in understanding those in general terms.
A tied variable can be explained in two ways; I don't know which will be easier for you to understand. First, a tied variable is an object (as in object-oriented programming) that looks and behaves like a regular Perl data structure: a scalar, an array, or a hash. tie my($foo), 'Some::Scalar::Thing'; $foo = 3; print $foo; is the same as my $foo_object = Some::Scalar::Thing->TIESCALAR; $foo_object->STORE(3); print $foo_object->FETCH(); If you're familiar with OOP, the 'TIESCALAR' method is analogous to the usual 'new' method -- it creates the object. When you tie a variable, though, the object is hidden from the interface: you use a normal Perl variable that is "hooked" to an object. The other way to explain it is that a tied variable is a variable that you can intercept ALL accesses to. As shown above, there are functions called (Some::Scalar::Thing::STORE and Some::Scalar::Thing::FETCH) whenever a tied scalar is given a value or requested its value. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ CPAN ID: PINYAN [Need a programmer? If you like my work, let me know.] <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>