Public feed #722296

Something

public text v1 · immutable
Raw Edit
·published 2007-10-01 22:09 UTC
rendered paste body
#!/usr/bin/perl

use CGI::Pretty qw( :html3 );
use DBI;
use strict;
use CGI qw/:standard/;
#my $dbiuid = 'uid';
#my $dbipwd = 'pwd';
#my $dbh = DBI->connect( 'DBI:mysql:housing;host=localhost', $dbiuid, $dbipwd ) || die "Could not connect to database: $DBI::errstr";
my $file = 'ss.txt';
my $line=0;

print header,
start_html('SS');

open (FILE, $file) or die "Can't open $file:  $!\n";
while(<FILE>){
        next if /^(\s)*$/;
        chomp;
        $line++;
        if($line == 1){
                my(undef,$lot,$date) = split(/\s+/, $_);
                $date =~ s/\n//;
                print "$lot $date<br>";
                next;
        }
        if($line == 2){
                my $lien = $_;
                print "$lien<br>";
                next;
        }
        if($line == 3){
                my $owner = $_;
                print "$owner<br>";
                next;
        }
        if($line == 4){
                my $address = $_;
                my $city = $address;
                $city =~ /(\w+)$/;
                my $test = $1;
                print "$address - $test<br>\n";
                next;
        }
        if($line == 5){
                my $price = $_;
                $price =~ s/\$//;
                $price =~ s/,//g;
                print "$price<br>\n";
                $line=0;
                next;
        }
}