Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Parse into array

by nagalenoj (Friar)
on Mar 12, 2009 at 04:11 UTC ( #750075=note: print w/replies, xml ) Need Help??

in reply to Parse into array

This is just another way to solve your problem.
use strict; use warnings; while( <DATA> ) { foreach ( split "<b>" ) { # used .* since HTML code can be nested like <b><i>injury</i>< +/b> (my $name) = $_ =~ /(.*?)\<\/b\>/; print "$name\n" if ( defined( $name ) ); } } __DATA__ <td>Suggested Categories or Articles</td><td> <b><i>personal injury</i +></b> <font size="-3" face="Verdana"> (0.56)</font><br><b>accident la +wyers</b> <font size="-3" face="Verdana"> ( 0.4)</font><br><b>attorne +ys</b> <font size="-3" face="Verdana"> (0.35)</font><br><b>law firms< +/b> <font size="-3" face="Verdana"> (0.32)</font><br><b>litigation</b +> <font size ="-3" face="Verdana"> (0.32)</font><br></td>
The output will be like
<i>personal injury</i> accident lawyers attorneys law firms litigation

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://750075]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2017-06-23 08:06 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (538 votes). Check out past polls.