[tpm] Split a string in half
linux at alteeve.com
Sat Mar 14 20:21:18 PDT 2009
I need to split a sting in half, and I can assume the the middle
character in the string will be a space ' ' character. I cannot predict
how many spaces will be in the string though.
In short; How could I split:
'foo bar foo bar' => 'foo bar', 'foo bar'
'baz baz' => 'baz', baz'
'foo bar baz foo bar baz' => 'foo bar baz', 'foo bar baz'
I use WWW::Mechanize, and I am running into a problem with a website
that uses an image and text in a single anchor. Specifically, the alt
text is the same as the text, so the 'find_all_links' function returns:
foo bar foo bar
<a href="..."><img src="..." alt="foo bar"> foo bar</a>
I never know what the link will be, only that the alt and text will
be that same.
More information about the toronto-pm