On Nov 22, 6:16 am, [EMAIL PROTECTED] (Dermot) wrote: > 2008/11/22 Sureshkumar M (HCL Financial Services) <[EMAIL PROTECTED]>: > > > > > Hi All, > > Hi > > > > > #!/usr/bin/perl > > # Always use these, particularly when things aren't working as expected. > use strict; > use warnings; > > > open(DATA,"i")||die "Unable to open the file"; > > > while(<DATA>) > > > { > > > if($_=~/(\d{2})([\W])\1\2\1]/) > > I could be wrong but I don't think \w will not match a hypen "-" so > the test will fail. > This works for me: > > if ($_=~/\d{1,2}-(\d{2}|\w{3})-\d+/) > > HTH, > Dp.
Thanks for the reply. I added strict and warning, and thankfully, there were no messages. The while loop on the file handle makes sense - I should do that. What are you referring to in the if part? I see I have an unescaped hyphen which I will make \- in the regexp compare. But what is the compare you are writing? Also, I ran the script many times just now - it runs so fast, I can't see why it's causing the CPU surge: <Q>$ time proc-js*pl 0.29s real 0.24s user 0.04s system <Q>$ time proc-js*pl 0.33s real 0.28s user 0.03s system <Q>$ time proc-js*pl 0.39s real 0.34s user 0.05s system David -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/