Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by kiat (Vicar)
on Jul 19, 2004 at 08:47 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://375493]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-16 18:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found