Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Replacing parts of a string

by arturo (Vicar)
on Apr 11, 2003 at 14:52 UTC ( #249901=note: print w/ replies, xml ) Need Help??

in reply to Replacing parts of a string

OK, this will not enhance your regex-fu, and it may not be the most efficient (in terms of runtime resource allocation) solution, but it's a dead easy one to use, and very efficient in terms of programmer-hours spent on the problem. Following up on jasonk's suggestion, you don't even need it to be the case that the script doing the parsing is Simply feed the query string to a object and let it do the parsing for you:

#!/usr/bin/perl + use CGI; use strict; use warnings; # note you want everything after the ? my $querystring='loginid=102138&month=04&year=2003&student_id=&user_ty +pe=TUTOR&CalendarName=102138Academic&framename=top.index_main&session +_number=618280744437303'; + my $q = CGI->new($querystring); + foreach my $p ( $q->param() ) { print "Parameter $p : " . $q->param($p) . "\n"; } +

If not P, what? Q maybe?
"Sidney Morgenbesser"

Comment on Re: Replacing parts of a string
Download Code
Replies are listed 'Best First'.
Re: Re: Replacing parts of a string
by aquarium (Curate) on Apr 12, 2003 at 10:14 UTC
    ditto...use or similar--or be at the peril of code injection inside URLs. You should also use taint...and check (with a simple regex) that the parameters you receive are alphanumeric only (no quotes etc.) Chris

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2015-11-28 20:21 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (744 votes), past polls