Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU |
On Monday 12 May 2003 03:43 pm, Eric Schwartz wrote: > Hello all, > I am new to perl and was wondering if you could help me out. I need to > find out how to search a variable. > <tr> <td valign=top width=194><font class=s2 face="Arial,Helvetica" > size=2>Total Sheets Fed</font></td> > <td valign=top width=130><font class=s2 face="Arial,Helvetica" > size=2>59986</font></td> > I need to sort out the Total sheets fed, and the amount, which will be > changing, in this case it is 59986. #!/usr/bin/perl $inString=qq(<tr> <td valign=top width=194><font class=s2 face="Arial,Helvetica" size=2>Total Sheets Fed</font></td> <td valign=top width=130><font class=s2 face="Arial,Helvetica" size=2>59986</font></td> ); ($totalSheets)=($inString =~ /<td.*Total Sheets Fed.*?>(\d+)</s); print("Total sheets = '$totalSheets'\n"); Of course, if the only 130-wide column is total sheets fed, then you can use the more robust ($totalSheets)=($inString =~ /<td valign=top width=130><font class=s2 face="Arial,Helvetica" size=2>(\d+)</s); ------------------------------------------------------------------- DDDD David Kramer http://thekramers.net DK KD DKK D "Before you criticize someone, you should walk a mile in DK KD their shoes. That way, when you criticize them, you're a DDDD mile away and you have their shoes." ??
BLU is a member of BostonUserGroups | |
We also thank MIT for the use of their facilities. |