http://www.perlmonks.org?node_id=893018


in reply to Store image in string

You could store the image data encoded as something like Base64, and then decode it when you print it to file, like this:

#!perl use strict; use warnings; use MIME::Base64; my $data = < base64-encoded data here >; open my $outfile, '>', 'file.gif' or die $!; binmode $outfile; print {$outfile} decode_base64($data); close $outfile;

See the MIME::Base64 manpage for information about Base64 encoding, as well as examples of encoding files.

Update: Oops, sorry Grandfather, you were too quick for me.

Another Update: Link fixed.