Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Chomping most of a _long_ text string

by ihb (Deacon)
on May 29, 2005 at 18:37 UTC ( #461553=note: print w/replies, xml ) Need Help??


in reply to Re: Chomping most of a _long_ text string
in thread Chomping most of a _long_ text string

I pondered whether I prefered index() or $+[0] and I concluded $+[0]. The index() expression becomes so cluttered, and it has a problem if the substring isn't found. Then you'll destroy the beginning of the string anyway, and remove $u-1 chars from the beginning. I figured that most likely, if the marker isn't there, it's already removed. If not you still need to perform some check, and for me the regex version is nicer.

I'd like to flip the coin and say "matching works find here, no need to use index()", but if one likes index() one should use index(). :-)

ihb

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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2020-10-26 07:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (250 votes). Check out past polls.

    Notices?