#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::JPEG; my @bilder; my $j; pic(); for($j=0;$j<@bilder;$j++) { my $fenster = MainWindow->new(); my $img = $fenster->Photo(-file => $bilder[$j], -format => "JPEG", ); $fenster->Button( -image => $img, -command => sub { $fenster->destroy(); } )->pack; MainLoop(); } sub pic { my @datei; my $i; opendir(DIR, "test"); @datei = readdir(DIR); for $i (0..$#datei) { if($datei[$i]=~/.jpg/) { push( @bilder, $datei[$i] ) } } closedir(DIR); }