use strict; use IO::Scalar; my $body = &get_body(); # whatever... my $handle = new IO::Scalar($body); # now call the method that expects a file handle