arthurracoon
The Cardinal Smiles
anyone?
i need some help
i need some help
Djaughe said:Hmmm...this image pops up under google...hope it helps.
Ryanwb said:...Ravi, my co-worker is really good at Perl, what is your question and I'll give it to him. It will seem like I'm working
Ryanwb said:That's because the camel is on the cover of the O'Reilly book
Ravi, my co-worker is really good at Perl, what is your question and I'll give it to him. It will seem like I'm working
Djaughe said:Ask yer coworker what the relationship is between camel and Perl...assface wants to know.
You must be registered for see images attach
arthurracoon said:actually, I got it figured out
thanks anyway though
arthurracoon said:anyone?
i need some help
arthurracoon said:Ok. I have a queston:
$content = "><tr><td valign="top" width="180" nowrap="1" bgcolor="#CCCCFF">Primary SGDID</td><td width="3"> </td><td valign="top">S000004814</td></tr></table></td></tr> <tr><td colspan="2"><center><table cellpadding="2" width="100%" cellspacing="3" border="0"><tr><td><font size="3" face="times"><b>";
#I pulled the HTML off the web (its only a portion of what I get off the web)
#Basically I need to get the S000004814 out of it (in bold)
#This is what I have so far.
if($content =~ /Primary\sSGDID</td><td\swidth="3"\s</td><td\svalign="top">([A-Z]\d+)\n/)
{
print $1;
}
#the problem im having is with the all of the backslashes in there, and maybe the quotes as well
$content = "><tr><td valign="top" width="180" nowrap="1"
bgcolor="#CCCCFF">Primary SGDID</td><td width="3"> </td><td
valign="top">S000004814</td></tr></table></td></tr> <tr><td
colspan="2"><center><table cellpadding="2" width="100%"cellspacing="3"
border="0"><tr><td><font size="3" face="times"><b>";
if($content =~
/Primary\sSGDID</td><td\swidth="3"\s</td><td\svalign="top">([A-Z]\d+)\n/) {
print $1;
}
KloD said:There are several things wrong with the script.
Two problems with the assignment to $content.
1) This code won't run because the quoting is wrong around the value assigned to $content.
2) You're screen-scraping. This method of retrieving data is notoriously unreliable, since any minor change in the layout of the HTML and data can force him to modify the script. Screen-scraping is to be avoided whenever possible.
Three problems with the pattern above.
1) All of the literal '/' characters have to be escape.
(i.e. </td> should be <\/td>)
2) <td\swidth="3"\s should be <td\swidth="3">\s
(missing '>')
3) You have '\n' at the end of the pattern. Try <\/td>, instead.
- KloD
arthurracoon said:thanks!
Im gonna try to find some perl modules to directly access the database tommorow, but I wanted to get this working first.
I actually got the $content directly from online. I just used the quotes for this.