Perl search and save
David Kramer
david at thekramers.net
Mon May 12 16:18:24 EDT 2003
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." ??
More information about the Discuss
mailing list