use SWF::File; use IO::Scalar; my $swf_data = ''; my $swf_fh = IO::Scalar->new( \$swf_data ); my $swf = SWF::BinStream::Write->new($swf_fh); ... $swf->close(); close $swf_fh; print $swf_data;