V
Voitec
Hi,
The following refers to this URL:
http://www.homepriceguide.com.au/snapshot/price/index.cfm?action=view&suburbORpostcode=2040
where the last 4 digits in the link is the rotating postcode.
I'd like to get data from this site and form trendlines.
Here's the code:
************
#!/usr/bin/perl -w
# Real estate price movement by suburb
use strict;
use LWP::Simple;
my $Postcode;
for ($Postcode = 2040; $Postcode < 2042; $Postcode++) {
my $html = get("
http://www.homepriceguide.com.au/snapshot/price/index.cfm?action=view&suburbORpostcode=$Postcode")
or die "Couldn't fetch the Suburb page.";
$html =~ m{<td align=\"center\" class=\"tbody\">(\$[\d,]+)</td>}g;
my $House_Suburb_Avg = $1;
my $House_Region_Avg = $1;
my $House_Suburb_Median = $1;
my $House_Region_Median = $1;
$html =~ m{<td align=\"center\" class=\"tbody\">([+|-][\d]+%)</td>}g;
my $House_Suburb_Median_Change = $1;
my $House_Region_Median_Change = $1;
$html =~ m{<td align=\"center\" class=\"tbody\">(\$[\d,]+)</td>}g;
my $Unit_Suburb_Avg = $1;
my $Unit_Region_Avg = $1;
my $Unit_Suburb_Median = $1;
my $Unit_Region_Median= $1;
$html =~ m{<td align=\"center\" class=\"tbody\">([+|-][\d]+%)</td>}g;
my $Unit_Suburb_Median_Change = $1;
my $Unit_Region_Median_Change = $1;
print "Here are 2002/2003 Prices for: $Postcode. \n";
printf "Average House Price: $House_Suburb_Avg - $House_Region_Avg\n";
printf "Median Price: $House_Suburb_Median - $House_Region_Median\n";
printf "Median change over last 12 months: $House_Suburb_Median_Change -
$House_Region_Median_Change\n";
printf "Average Unit Price: $Unit_Suburb_Avg - $Unit_Region_Avg\n";
printf "Median Price: $Unit_Suburb_Median - $Unit_Region_Median\n";
printf "Median change over last 12 months: $Unit_Suburb_Median_Change -
$Unit_Region_Median_Change\n";
print "\n";
}
************
My problem is that $1 stays the same throughout as $650,682 for Postcode
2040 & it stays as $1,040,070 for Postcode 2041.
I'm sure I'm doing something surprisingly silly. Any help would be
appreciated.
Thanks,
Voitec
The following refers to this URL:
http://www.homepriceguide.com.au/snapshot/price/index.cfm?action=view&suburbORpostcode=2040
where the last 4 digits in the link is the rotating postcode.
I'd like to get data from this site and form trendlines.
Here's the code:
************
#!/usr/bin/perl -w
# Real estate price movement by suburb
use strict;
use LWP::Simple;
my $Postcode;
for ($Postcode = 2040; $Postcode < 2042; $Postcode++) {
my $html = get("
http://www.homepriceguide.com.au/snapshot/price/index.cfm?action=view&suburbORpostcode=$Postcode")
or die "Couldn't fetch the Suburb page.";
$html =~ m{<td align=\"center\" class=\"tbody\">(\$[\d,]+)</td>}g;
my $House_Suburb_Avg = $1;
my $House_Region_Avg = $1;
my $House_Suburb_Median = $1;
my $House_Region_Median = $1;
$html =~ m{<td align=\"center\" class=\"tbody\">([+|-][\d]+%)</td>}g;
my $House_Suburb_Median_Change = $1;
my $House_Region_Median_Change = $1;
$html =~ m{<td align=\"center\" class=\"tbody\">(\$[\d,]+)</td>}g;
my $Unit_Suburb_Avg = $1;
my $Unit_Region_Avg = $1;
my $Unit_Suburb_Median = $1;
my $Unit_Region_Median= $1;
$html =~ m{<td align=\"center\" class=\"tbody\">([+|-][\d]+%)</td>}g;
my $Unit_Suburb_Median_Change = $1;
my $Unit_Region_Median_Change = $1;
print "Here are 2002/2003 Prices for: $Postcode. \n";
printf "Average House Price: $House_Suburb_Avg - $House_Region_Avg\n";
printf "Median Price: $House_Suburb_Median - $House_Region_Median\n";
printf "Median change over last 12 months: $House_Suburb_Median_Change -
$House_Region_Median_Change\n";
printf "Average Unit Price: $Unit_Suburb_Avg - $Unit_Region_Avg\n";
printf "Median Price: $Unit_Suburb_Median - $Unit_Region_Median\n";
printf "Median change over last 12 months: $Unit_Suburb_Median_Change -
$Unit_Region_Median_Change\n";
print "\n";
}
************
My problem is that $1 stays the same throughout as $650,682 for Postcode
2040 & it stays as $1,040,070 for Postcode 2041.
I'm sure I'm doing something surprisingly silly. Any help would be
appreciated.
Thanks,
Voitec