Radu Greab skribis 2008-04-14 22:19 (+0300):
>   $data =~ s/\r\n\.\r\n(.*)\z/\r\n/ms

If you don't want to use the regex engine (and indeed, especially
regexes with .* are often inefficient), you could use good old index and
substr to achieve the same:

    # untested code
    my $data_end = index($data, "\r\n.\r\n");
    if ($data_end >= 0) {
        substr($data, $data_end + 2, length($data) - ($data_end + 2), "");
        ...
    }

I'm not familiar with the rest of the code and I have not attempted to
understand its workings. This suggestion may not work in the given
context. Use with caution, etc, bla bla.

Also, I have not benchmarked this.
-- 
Met vriendelijke groet,  Kind regards,  Korajn salutojn,

  Juerd Waalboer:  Perl hacker  <[EMAIL PROTECTED]>  <http://juerd.nl/sig>
  Convolution:     ICT solutions and consultancy <[EMAIL PROTECTED]>

Reply via email to