Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Chomping most of a _long_ text string

by davidrw (Prior)
on May 29, 2005 at 18:52 UTC ( [id://461559]=note: print w/replies, xml ) Need Help??


in reply to Chomping most of a _long_ text string

Im not sure if this is any better performance-wise than the regex suggestions, but you could use split:
(undef, $goodpart) = split(/_{70}/, $msg);
This works better if $msg is a single email at a time, though you could split a whole inbox as well...

Replies are listed 'Best First'.
Re^2: Chomping most of a _long_ text string
by ihb (Deacon) on May 29, 2005 at 19:19 UTC

    You'd better have a limit on that split as well, so that you don't chop up any e-mails that have 70 underscores in it:

    (undef, $goodpart) = split /_{70}/, $msg, 2;
    Note that since this supposedly is a huge string you create a huge copy while doing this, even if you assign it back to $msg, afaik.

    ihb

    See perltoc if you don't know which perldoc to read!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://461559]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-03-28 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found