#!/usr/bin/perl print "Content-type: text/html\n\n"; opendir CARD_DIR, "../cards/images"; while ($_ = readdir CARD_DIR) { next unless /^(.+?)\.png$/; print "\n"; } closedir CARD_DIR;