Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners Cgi > Re: Example Inp...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 1380 of 1490
Post > Topic >>

Re: Example Input Datas

by pangj@[EMAIL PROTECTED] (Jeff Pang) Mar 8, 2007 at 11:59 AM

>
>Hi Jeff,
>
>This IP 192.168.1.1 will replaced by IP defined from user.
>
>example:
>
>Enter with IP : 10.0.0.1
>Submit
>
>When somebody  to type one value, it will replaced the file value.
>
>IP: 192.168.1.1 -> will be replaced -> 10.0.0.1
>

Got it.Then your script is may right.
The only note is the meta-characters.becase '.' is a meta-character in
Perl,so given this case:

$source_ip = '192.168.1.1';
$dest_ip = '10.0.0.1';
s/$source_ip/$dest_ip/g;

maybe meet some problems.
The better way is use \Q for disable quote meta-characters.like:

s/\Q$source_ip/$dest_ip/g;

From perldoc perlre:

           \E          end case modification (think vi)
           \Q          quote (disable) pattern metacharacters till \E

Hope this useful.

--
http://home.arcor.de/jeffpang/
 




 1 Posts in Topic:
Re: Example Input Datas
pangj@[EMAIL PROTECTED]   2007-03-08 11:59:29 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 13 11:11:25 CDT 2008.