nntp2http.com
Posting
Suche
Optionen
Hilfe & Kontakt

How can I check if a string belongs to a string array

Von: mosfet (john.doe@anonymous.org) [Profil]
Datum: 02.10.2007 15:49
Message-ID: <47024c5f$0$26161$426a34cc@news.free.fr>
Newsgroup: alt.perl
Hi,

I need a function to check if a file has the right extension

my @validExt = (".exe", ".mui", ".dll" );
sub IsValidExt
{
??????
}

Here is my script  :


opendir MYDIR, ".";
my @contents = grep !/^\.\.?$/, readdir MYDIR;
my @validExt = (".exe", ".mui", ".dll" );

foreach my $listitem ( @contents )
{
$extension = substr( $listitem, rindex( $listitem, '.' ) + 1 );
$filesize = stat($listitem)->size;
$totalsize += $filesize;
my @args = ($DumpBin, $listitem );


#System need to be called if file has valid extension !!!!!!!!!!!!!

????
system(@args) == 0 or die "system @args failed: $?";



print "\\Program Files\\Voxmobili\\Voxsync\\", $listitem, ";",
$extension, ";", $filesize;
print ";", ";", ";", ";", ";",
"\n";
}

[ Auf dieses Posting antworten ]

Antworten