At 10:57 PM 6/25/00, Riccardo Perotti wrote: >Hi all: > >I saw it in some script: > > Print "Location: www.domain.com/hatever.html" > >Is this script telling the browser to "go there"? or is it just "printing" >the URL into the browser's Location (the user needing to press enter of 'go' >or whatever in his bowser)? "Go there." And, yes to your previous question. If a CGI script named www.domain.com/path/a.cgi executes the statement print "Location: www.domain.com/another/path/b.cgi\n\n"; then what goes to the user's browser will be the output of b.cgi assuming b.cgi exists, etc. The first can pass query strings and path info to the second, too: print "Location: www.domain.com/another/path/b.cgi?id=xyz123\n\n"; print "Location: www.domain.com/another/path/b.cgi/morepath/datafile.txt\n\n"; But: a. the Perl function 'print' is all lower case. b. "Location: [URL]" is an http header, so it must have a blank line immediately following, hence the two 'newlines' (\n\n but see *). c. If your script has already executed print "Content-type: text/html\n\n" in preparation for sending some HTML back to the user, then print "Location: ... " won't work, or rather, you'll get "Location: ..." printed out somewhere on screen, and it won't be a link either. * Here's a potentially confusing diversion NOT relevant to your question about print "Location: ...", but since I used "\n\n" above, there's bound to be an objection: Be careful: in Perl \n stands for whatever the local 'newline' is for the OS it's operating under, which means that in MAC OS it's really \r or \015 (Carriage Return), in UNIXish it's really \n or \012 (Line Feed), and in DOS/Win it's really \n\r or \015\012 (CRLF). Most of the time, Perl hides this problem from you, and it's safe to use "\n\n". Crossing platforms takes a little more care, such as when counting characters, or processing <TEXTAREA> input in which the user has hit Return. If you really want to cover all eventualities, then filter your input like this: $line =~ s/\015\012?|\012/\n/g; HTH 1; -- - Bruce __Bruce_Van_Allen___bva@cruzio.com__Santa_Cruz_CA__ ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org