The value of explaining a problem to yourself like you would to someone else [Was going to be: Program does not do what I want but produces no error messages either]

Andy Selby andyfrommk at
Tue Oct 12 10:21:59 PDT 2010

I've probably mentioned this before at the pub but I have had great
insight into a problem when I try to explain it in a mailing list or
forum post and suddenly I am able to see the cause of the problem.
I pasted in the code first then wrote a outline and was going to list
the values of my variables when I realised $thumbs was already
populated with the filenames so what did I need $dh for?

Below is the post I was going to send, you can see how I was about to
write the value of $dh when I realised it was only the directory that
the images where in and not the images themselves so therefore no

See you all at the tech-meet.

I'm trying to write a program to turn an directory of images into a
directory of thumnails,
the below program does not do this but produces no error messages so I
think there is something wrong with were it is outputting to.

If I output the value of @thumbs it is the list of images

#!/usr/bin/perl -w
use strict;
use Image::Thumbnail 0.6;
my $dh = "/home/andy/projects/images";
opendir DH, $dh or die "cannot open $dh: $!";
my @thumb = readdir DH;
foreach my $thumb (@thumb)
my $t = new Image::Thumbnail(
                size       => "200x200",
                create     => 1,
                module     => "GD",
                input      => $dh,
                outputpath => "/home/andy/projects/thumbs",

More information about the MiltonKeynes-pm mailing list