Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

by kiat (Vicar)
on Jul 19, 2004 at 08:47 UTC ( #375493=note: print w/ replies, xml ) Need Help??


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

Thanks, theAcolyte!

Ran your code. I think you need to add a space here:

$clipped .= $_; # orginal $clipped .= "$_ "; # changed
With your code, when I passed the sub a string such as "this is a very long sentence without spaces in between", it gets transformed to "thisisaverylongsentencewithout" i.e. the original spaces were gone.

cheers


Comment on Re^2: In search of a better way to trim string length
Download Code
Re^3: In search of a better way to trim string length
by theAcolyte (Pilgrim) on Jul 20, 2004 at 00:30 UTC
    blah ... right you are! See what I get for posting untested code? Then again, I always post untested code ... :P

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2014-10-23 05:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (124 votes), past polls