1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
ny( @document, @image, @data );
my %diispatch = (
map( { $_, \@data},
qw{ htm asp aspx ...}
),
map( { $_, \@image},
qw{ jpg gif png swf ... }
),
map( { $_, \@document},
qw{ doc rtf txt ...}
),
);
my @source = qw/ a.doc B.DOC, c.jpg, d.mp3 /;
for my $s( @source ) {
my ($ext) = ($s =~ /\.([^.]+)$/);
if( !$ext ) {
warn "pas d'extension dans [$s]\n";
next;
}
$ext = lc $ext;
if( not exists $dispatch{$ext} ) {
warn "extension [$ext] ignorée dans [$s]\n";
next;
}
push @{$dispatch{$ext}}, $s;
} |
Partager