linkagent wrote: > ----- Original Message ----- > From: "Ron Hartikka" <[EMAIL PROTECTED]> > >>for $number (1006326869812, 563296853235993 , 35968322963568389){ >>print "$1-$2-$3\n" if ($number =~ /(\d*)(\d{4})(\d{5})/); >> > > I need members help on this; > Q1) As far as I know, \d* means match either 0 or more digits, since > /(\d*)/ match 1006326869812 , therefore > I could not see how /(\d*)(\d{4})(\d{5})/) could seperate 1006326869812 into > (1006)(3268)(69812)
The last two parts of the regex pick up 4 and 5 digits resp. The first picks up all the rest since it's 0 or more. Obviously some back-tracking has to occur since the first length is unknown. It might be faster to anchor the back end: /(\d*)(\d{4})(\d{5})$/ > Q2) Out of curiosity, I tried the undermentioned but I could not > understand why on the 3rd iteration it print only 3 instead of > 35968322963568389 :- > > for $number (1006326869812, 563296853235993 , 35968322963568389){ > print "$1\n" if ($number =~ /(\d*)/); > } The third number is too large to express as an integer. Try putting quotes around it so it's treated as a string. -- ,-/- __ _ _ $Bill Luebkert ICQ=14439852 (_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED] / ) /--< o // // http://dbecoll.tripod.com/ (Free site for Perl) -/-' /___/_<_</_</_ Castle of Medieval Myth & Magic http://www.todbe.com/ _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users