Greetings,

Thanks for the help so far,

I am added switch...   but not sure that I have syntax correct....
Maybe this is best written as if else logic....

and or:
my $action = $q->param( "action" );

SWITCH ($action) {
    
    if  (/Upload/) {
        last SWITCH;    
    };
    
etc.......



--- what I have now----
use CGI qw/:standard/;
use CGI;
use Fcntl qw( :DEFAULT :flock );
use CGI::Carp qw(fatalsToBrowser);
use strict;
use switch; 


my $action = $q->param( "action" );

SWITCH: {
    
    if  ($action =~ /Upload/) {
        last SWITCH;    
    };
    
    if  ($action =~ /Update/) {
        print redirect("./import_clean_csv.php");
        exit;
        last SWITCH;    
    };
        
    if  ($action =~ /Clean/) {
    my @filesToRemove;  
     
    chdir UPLOAD_DIR or die "Couldn't chdir to afm_data directory: $!";
    
    #my @filesToRemove  =  map  {$_ =~ /^(\w[\w.-]*)/} <*>;
    
    opendir(DR,"./");
    @filesToRemove  =  grep  {$_ =~ /^(\w[\w.-]*)/} readdir DR;
    closedir DR;


print $HTML_HEADER;
print '<div align="center">';


    foreach my $fr (@filesToRemove) {
    
    print  "Deleted $fr<br>\n";
    unlink($fr)  or die "Couldn't Delete $fr $!";
    }



print <<HTML_OUT;
<p class="top-header">Your Done close this window! 
<form><input type="button" onclick="self.close()" value="Close  
Window"></form></p>
</div>
HTML_OUT
print end_html;

        exit;
        last SWITCH;
    };

}


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to