Thread if-abfrage ... warum nicht
(10 answers)
Opened by jan999 at 2009-05-15 18:55
Mach das lieber anders.
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 my $site_type = $g_TagAttrs{'site_type'} || undef; my $lookup = { megalith => sub { print '..'; }, tumulus => sub { print "==> tumulus zugewiesen !!!\n"; $icon_name = 'tumulus'; }, fortification => sub { print "==> fortification"; }, bigstone => sub { print "==> bigstone"; } }; if (defined $site_type) { $lookup->{$site_type}->() if exists $lookup->{$site_type}; } Viel übersichtlicher, und viel einfacher zu warten. Last edited: 2009-05-15 19:50:15 +0200 (CEST) Viele Grüße :)
|