CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Perl Archive search error, need help :)

 



Aquilo
journeyman

Feb 3, 2001, 1:42 AM

Post #1 of 4 (367 views)
Perl Archive search error, need help :) Can't Post

I tryed searching for this in the learning center but got errors :)

This is for jave script how can I make this perl??

In Reply To
just FYI, you can also implement the modulus function.
i think it may be something like \ or // in some languages, but in JS its %
basically for a % b it would divide a by b then return the remainder.


Code
" The black lines or  are % 10 with out a space " 

if ((myweekday)==1) { myext = "st"; }
else if((myweekday) == 2) { myext = "nd"; }
else if((myweekday) == 3) { myext = "rd"; }
else { myext = "th"; }


Code
	if (($mday) eq "1") { $hy = "st"; } 
elsif (($mday) eq "2") { $hy = "nd"; }
elsif (($mday) eq "3") { $hy = "rd"; }
else { $hy = "th"; }

Also why don't your search script just cut out / and \ if it's going to go into an error

Code
Content-type: text/html  

CGI ERROR
==========================================
Error Message : fatal error: [Sat Feb 3 03:24:08
2001] search2.cgi: /\/: trailing \ in regexp
at /home/perlarchive/www/cgi-bin/new/headfoot.cgi line 226.

Script Location : search2.cgi
Perl Version : 5.006

Form Variables
-------------------------------------------
Format : Standard
Range : All
bool : or
mh : 25
query : \ or //
searchcat : guide
type : keyword

Environment Variables
-------------------------------------------
DOCUMENT_ROOT : /www/perlarchive
GATEWAY_INTERFACE : CGI/1.1
HTTP_ACCEPT : image/gif, image/x-xbitmap,
image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel,
application/msword, */*
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_ACCEPT_LANGUAGE: en-us,ie-ee;q=0.5
HTTP_CONNECTION : Keep-Alive
HTTP_HOST : www.perlarchive.com
HTTP_REFERER : http://www.perlarchive.com/search/search2.cgi?
Range=Any&Format=Standard&query=modulus&mh=
25&type=keyword&bool=or&searchcat=guide
HTTP_USER_AGENT : Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
PATH : /usr/local/bin:/usr/bin:/bin
QUERY_STRING : Range=All&Format=Standard&query=\+or+//+&mh=25
&type=keyword&bool=or&searchcat=guide
REMOTE_ADDR : 208.8.113.30
REMOTE_PORT : 4945
REQUEST_METHOD : GET
REQUEST_URI : /search/search2.cgi?
Range=All&Format=Standard&query=\+or+//+&mh=25
&type=keyword&bool=or&searchcat=guide
SCRIPT_FILENAME : /www/perlarchive/search/search2.cgi
SCRIPT_NAME : /search/search2.cgi
SERVER_ADDR : 216.71.44.169
SERVER_ADMIN : webmaster@perlarchive.com
SERVER_NAME : www.perlarchive.com
SERVER_PORT : 80
SERVER_PROTOCOL : HTTP/1.1
SERVER_SOFTWARE : Apache/1.3.12 (Unix) FrontPage/4.0.4.3



Jasmine
Administrator / Moderator

Feb 3, 2001, 11:53 AM

Post #2 of 4 (361 views)
Re: Perl Archive search error, need help :) [In reply to] Can't Post

Thanks for pointing that out. As you may have noticed, we've made lots of changes to the Perl Archive recently, which obviously broke the Guide's search function Smile

All fixed -- thanks again!



Aquilo
journeyman

Feb 3, 2001, 9:35 PM

Post #3 of 4 (358 views)
Re: Perl Archive search error, need help :) [In reply to] Can't Post

No problem I should know it's not going to search for " \ or // " any way :)

OK after looking at the code I think it would be:

Code
	if (($mday / 10) eq "1") { $hy = "st"; } 
elsif (($mday / 10) eq "2") { $hy = "nd"; }
elsif (($mday / 10) eq "3") { $hy = "rd"; }
else { $hy = "th"; }

I wount know untill the 21st :)




muinatit
Deleted

Feb 4, 2001, 5:35 AM

Post #4 of 4 (355 views)
Re: Perl Archive search error, need help :) [In reply to] Can't Post

Try this:


Code
if (($mday / 10) == 1) { $hy = "st"; } 
elsif (($mday / 10) == 2) { $hy = "nd"; }
elsif (($mday / 10) == 3) { $hy = "rd"; }
else { $hy = "th"; }


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives