Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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

Replies are listed 'Best First'.
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 God said, "Let Newton be!"...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2016-12-11 08:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (169 votes). Check out past polls.