Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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 lurking in the Monastery: (13)
As of 2015-07-02 11:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (34 votes), past polls