michael wang wrote:

if the minus sign always there, then use s/// seems faster than split, like

while(<DATA>){

    s/(\d)-/$1\t-/;
    print "$_";
}

I'm pretty certain the OP wanted the data separated into fields so it
would still have to be split. I do like the idea of adding the 'missing'
space and then splitting though as it seems more intuitive, although I
very much doubt if it is faster. Something like:

while (<DATA>) {

 s/(?<=\d)-/ -/g;
 my @data = split;

 print "@data\n";
}

You can do some timings if you like!


Rob


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


Reply via email to