... open(MYINPUTFILE, "<$load_file"); # open for input my(@lines) = ; # read file into list my($line); foreach $line (@lines) # loop thru list { chomp $line; @h = split(/\//, $line); #split the "/" to get hash value for dir my $hash = "$h[3]"; my $JPG = "$h[4]"; my $outfile = "/imagedb/thumb/$hash/$JPG"; #out put image my $out_path = "/imagedb/thumb/$hash"; my $image = Image::Resize->new($line); #make image my $gd = $image->resize(160, 120); open(FH, ">$outfile"); #print the image file print FH $gd->jpeg(); close(FH); #close image } close(MYINPUTFILE); ....