I've done that in C with Imlib2, which simply offers you an array of 32 bit values (3 x 8 bits for the color channel, and 8 bits for the alpha channel). Painting a pixel is a simple matter of assigning to that array.
There's a Perl binding for that, Image::Imlib2, which has set_colour and draw_point - that should be all you need.