The point is that certain functions expect to be passed filehandles for various purposes.
Sometimes the data you want to pass to these functions is actually held in a variable. The naive way of coping with that is to write out your data to a temporary file, open the file and pass the filehandle to the function. Often a better solution though is to construct a filehandle which points straight to the scalar variable, and not to a real file on disk.
Grandfather provides one technique, supported by Perl 5.8+. If (for some perverse reason) you want to support earlier releases of Perl, then IO::String also provides a solution using tied filehandles.
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
|