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

Re^2: substr question

by rowdog (Curate)
on Jun 18, 2010 at 21:20 UTC ( #845460=note: print w/ replies, xml ) Need Help??


in reply to Re: substr question
in thread substr question

if ( length($short) + length($parts[0]) <= $len ) { $short = join( ' ', $short, shift @parts ); }

The length is off by one because you add not only the part, but a new space as well. The easy fix is to delete the = from <= $len


Comment on Re^2: substr question
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (15)
As of 2014-10-24 13:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (132 votes), past polls