in reply to Re: read an integer from a file
in thread read an integer from a file

thanks for all especially to Boldra and Khen1950fx, i'm able to get the right result by changing this code from s/^http:\/\/(.*)\/(.*)/http:\/\/123.1.34.107:8080\/Web/; to s[^http://(.*)(.*)][http://123.1.34.107:8080]; May i know what is the difference with above code? as i manually test it for the 1st code,it seem to output the same input when i enter the input. and for 2nd code, i will get the right output=123.1.34.107 when i enter any input.

Replies are listed 'Best First'.
Re^3: read an integer from a file
by ikegami (Patriarch) on Jun 21, 2010 at 04:16 UTC
    The former adds /Web, the latter doesn't
      /web didn't give any effect to the output. i got the output when i change the slash to square bracket.

        No difference in output?

        $_ = 'http://www.foo.com/'; s/^http:\/\/(.*)\/(.*)/http:\/\/123.1.34.107:8080\/Web/; print("$_\n"); $_ = 'http://www.foo.com/'; s[^http://(.*)(.*)][http://123.1.34.107:8080]; print("$_\n");
        http://123.1.34.107:8080/Web http://123.1.34.107:8080