On Dec 10, 2003, at 4:49 PM, Ravi Malghan wrote:


Hi: I want to split the string
0.0.0.0.1.10.1.30.1.10.1.30.1

into 4 variables: 0.0.0.0, 1, 10.1.30.1 and 10.1.30.1

any suggestions?

yes, get better data.


a part of the problem you have is the that you
could do this with a regEx

        my $input = '0.0.0.0.111.10.1.30.1.10.1.30.1 ';
        
        my $dot_quad = qr/\d+\.\d+\.\d+\.\d+/;
        
        my ($im, $jm , $km, $mm ) =
                $input =~ /($dot_quad)\.(\d+)\.($dot_quad)\.($dot_quad)/;

cf perldoc perlre

ciao
drieux

---


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to