Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 wandering the Monastery: (11)
As of 2015-07-07 10:49 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 (88 votes), past polls