Forum Moderators: coopster & phranque

Message Too Old, No Replies

Splitting this into Two Lines?

         

sysdomatic

8:59 am on Dec 25, 2003 (gmt 0)

10+ Year Member



Hi all,

I'm having a bit of a problem. I have a really, really long line of code; so long that it won't fit into one line of my editor, so it screws up the problem. I'm kind of new to Perl, and have no idea how to split this into two parts, and then concatenate it so that it will work. any ideas?

my @pix = $html =~ m{<td class="yspscores" align="left"> <a href="/nhl/players/(.*?)">(.*?)</a></td>\n<td class="yspscores" align="left"><a href="/nhl/teams/(.*?)">(.*?)</a></td>\n<td class="yspscores">(.*?)</td>\n<td class="yspscores"> </td><td class="yspscores">(.*?)</td>\n<td class="yspscores"> </td><td class="yspscores">(.*?)</td>\n<td class="yspscores"> </td><td class="ysptblclbg6"><span class="yspscores">(.*?)</span></td>\n<td class="yspscores"> </td><td class="yspscores">(.*?)</td>\n<td class="yspscores"> </td><td class="yspscores">(.*?)</td>\n<td class="yspscores"> </td><td class="yspscores">(.*?)</td>\n<td class="yspscores"> </td><td class="yspscores">(.*?)</td>\n<td class="yspscores"> </td><td class="yspscores">(.*?)</td>\n<td class="yspscores"> </td><td class="yspscores">(.*?)</td>\n<td class="yspscores"> </td><td class="yspscores">(.*?)</td>\n<td class="yspscores"> </td><td class="yspscores">(.*?)</td>\n<td class="yspscores"> </td><td class="yspscores">(.*?)</td>}g;

vasiokla

5:25 pm on Dec 26, 2003 (gmt 0)

10+ Year Member



I think this idea may work:
First, you're spliting string:

my @html_array=split(/\n/,$html);

Then you're rotating array in foreach cycle:

foreach my $html (@html_array) {
# 1 or more regexpes must be there
push(@pix,$1); # myabe push(@pix,$2); etc
}