Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Split function 2

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
If there is a query string like this:


How to code def.cgi to split the "/" from "12345" AND redirect the user to


split(///,$ENV{'QUERY_STRING'}) doesn't seem to work. Maybe the server doesn't understand what "///" is.

If possible please give the complete code. Thanks!
 
This is what I cam up with...HTH




#===============================================
# def.cgi
#===============================================
#!/usr/bin/perl

use CGI;

$ENV{"QUERY_STRING"} =~ /\d+$/;
$matched=$&;
$query=new CGI;

print $query->redirect("


regards
C
 
Thank you so much!

But when I tried to excute the script on my server it returened "Internal Server Error" and I'm sure the file permission is right.

Could there be any problem...
 
The Server Error Log will have additional details reg the error. That could help us debug .



regards
C
 
Make sure the scripts have the right execute permissions and check if the headers for the scripts are in place. Better still...post the scripts .


regards
C
 
Or maybe the perl location is #!/usr/local/bin/perl
 
Thank you for all your help! It finally worked!

#!/usr/bin/perl must be in the first line.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top