Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re^5: In search of a better way to trim string length

by dragonchild (Archbishop)
on Jul 19, 2004 at 19:37 UTC ( #375668=note: print w/replies, xml ) Need Help??

in reply to Re^4: In search of a better way to trim string length
in thread In search of a better way to trim string

The issue arises from what constitutes a "word". The basic definition is @words = split ' ', $line;, which works in most cases. However, it's arguable that a better definition could be @words = $line =~ /(\b\w+(?:['-]\w+)\b)/;. Of course, you're now depending on the definition of \w, which includes underscore and doesn't include apostrophe or hyphen. *shrugs* YMMV a huge amount. Parsing any natural language is much harder than parsing Perl which, as everyone knows, can't be done in Perl.

Good luck! I mean it.

We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

I shouldn't have to say this, but any code, unless otherwise stated, is untested

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://375668]
[1nickt]: Corion HPs? ugh. I was impressed with Lenovo's gaming laptops; if it weren't for the red backlighting and general flashiness of the aesthetic, I might have gone with that. But all that was until I discovered that the Dell Precision line is still around.
[1nickt]: stevieb I don;t doubt that there's a difference. BestBuy has "consumer" models only on display.
[ambrus]: 1nickt: for some reason, these days they call every computer "gaming", even ones that gamers wouldn't buy. I've bought a keyboard that was labelled "gamer", despite that it has hard springs and seems to be way better for typing than for gaming;

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (15)
As of 2017-03-27 13:39 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.