Storable
The Storable package brings persistence to your Perl data structures containing SCALAR, ARRAY, HASH or REF objects, i.e. anything that can be conveniently stored to disk and retrieved at a later time.
It can be used in the regular procedural way by calling 'store' with a reference to the object to be stored, along with the file name where the image should be written.
For more information on Perl, see perl.com or perl.org.