in reply to URL $ENV variables
But you seem to be doing this in an awfully complicated way, and your parsing code is fragile (it will fail on:$attach1 =~ s/\?.*$//;
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:
But it fails if there are slashes in the query part of the string.$paramstr = '\?'.$ENV{QUERY_STRING}; $attach1 =~ s/$paramstr//;
|
|---|