For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > January 2005 > SWITCH / CASE statements









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SWITCH / CASE statements
David Gilden

2005-01-17, 3:55 am

Quick question here for the PERL gurus!

What should be the order for these two statements?

exit;
last switch; =20

i.e is this correct?

Thanks!!
Dave -- Ft. Worth

__CODE__

SWITCH: {
=20
if ($action =3D~ /Update/) {

print redirect("./import_clean_csv.php");
exit;
last switch; =20
};
=20
=20
if ($action =3D~ /Clean/) {

print header;

chdir UPLOAD_DIR or die "Couldn't chdir to afm_data directory: $!";

my @filesToRemove =3D <*>;

foreach my $fr (@filesToRemove) {

print "Deleting $fr<br>\n";
unlink($fr) or die "Couldn't Delete $fr $!";
}

print <<HTML_OUT;
<p style=3D"font-weight:bold">Your Done close this window!=20
<form><input type=3D"button" onclick=3D"self.close()" value=3D"Close Windo=
w"></form></p>
HTML_OUT

exit;
last switch;
};

}


Visit my schedule page for up to the minute performance info:
<http://www.coraconnection.com/cgi-bin/schedule.pl>


=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D=3D=3D=3D=3D
Cora Connection: Your West African Music Source
Resources, Recordings, Instruments & More!
<http://www.coraconnection.com/>=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
3D=3D=3D=3D=3D=3D=3D=3D
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com