Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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]
[pryrt]: also mismatches; but matches their sha1
[pryrt]: The mismatched ones have a Jan 23 2017 Last-Modified header -- I wonder if they rezipped them and forgot to update the sha1
[stevieb]: RT ticket for the csum mismatch of various versions of Strawberry Perl

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2017-03-29 21:10 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (353 votes). Check out past polls.