Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: URL $ENV variables

by sgifford (Prior)
on Aug 04, 2003 at 08:43 UTC ( [id://280606]=note: print w/replies, xml ) Need Help??


in reply to URL $ENV variables

I think you simply want:
$attach1 =~ s/\?.*$//;
But you seem to be doing this in an awfully complicated way, and your parsing code is fragile (it will fail on:
http://www.perlmonks.com/index.pl?node=Smokers/Jokers
, for example) Have you considered the URI module?

Update: I see why you'd want to use $ENV{QUERY_STRING}. The problem with your code is that the double-quotes are eating the backslash---by the time the regex sees the question mark it's unbackslashed, and so doesn't make any sense. Single quotes won't do that (at least not with a question mark). You're also missing the replacement string on your regex. This code works for me:

$paramstr = '\?'.$ENV{QUERY_STRING}; $attach1 =~ s/$paramstr//;
But it fails if there are slashes in the query part of the string.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://280606]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-18 22:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found