open PAGE, "$website" or die "Cant open $website: $!"; flock (PAGE, 1) or die "Can't lock website file for reading"; while (my $line = ()) { ($Prop,$colour,$txtcol,$url360,$user,$your_name,$address,$town,$zip_code,$country,$email,$telephone_no,$telephone_no2,$theme,$web_address,$ppemail,undef,undef,undef) = split "\t", $line; #create array of users and hash of data $onprop{$Prop} = [$Prop,$colour,$txtcol,$url360,$user,$your_name,$address,$town,$zip_code,$country,$email,$telephone_no,$telephone_no2,$theme,$web_address,$ppemail]; push (@dataarray, $user); } #iterate over users while (<@dataarray>) { my @microdata; #remove examine first user my $item = shift (@dataarray); foreach my $scalar (keys %onprop) { unless (! $item) { #compare lines of hash looking for lines with same user if ( @{ $onprop{ $scalar } }[4] eq $item) { #if found, remove from array my $a = shift(@dataarray); push (@microdata, @{ $onprop{ $scalar } }); } } } #store all results for this owner in single reference my $refmicro = \@microdata; push (@group, $refmicro); } foreach (@group) { print "@{ $_ }

"; } #### #!/usr/bin/perl -w use strict; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use CGI ':standard'; #definitions: #========= my ( $Prop, $colour, $txtcol, $url360, $user, $your_name, $address, $town, $zip_code, $country, $email, $telephone_no, $telephone_no2, $theme, $web_address, $ppemail ); my %onprop; my @dataarray; my @group; print "Content-type: text/html\n\n"; while (my $line = ()) { ($Prop,$colour,$txtcol,$url360,$user,$your_name,$address,$town,$zip_code,$country,$email,$telephone_no,$telephone_no2,$theme,$web_address,$ppemail,undef,undef,undef) = split "\t", $line; #create array of users and hash of data $onprop{$Prop} = [$Prop,$colour,$txtcol,$url360,$user,$your_name,$address,$town,$zip_code,$country,$email,$telephone_no,$telephone_no2,$theme,$web_address,$ppemail]; push (@dataarray, $user); } #iterate over users while (<@dataarray>) { my @microdata; #remove examine first user my $item = shift (@dataarray); foreach my $scalar (keys %onprop) { unless (! $item) { #compare lines of hash looking for lines with same user if ( @{ $onprop{ $scalar } }[4] eq $item) { #if found, remove from array my $a = shift(@dataarray); push (@microdata, @{ $onprop{ $scalar } }); } } } #store all results for this owner in single reference my $refmicro = \@microdata; push (@group, $refmicro); } foreach (@group) { print "@{ $_ }

"; } __DATA__ 012 undef undef undef graham undef undef undef undef undef undef 037 undef undef graham undef undef undef undef undef undef undef undef undef 028 red tdblk johnandmark undef undef undef undef undef undef undef undef 108 yellow tdblk undef johnandmark undef undef undef undef UK undef undef undef undef 013 blue tdblk undef jon undef undef undef undef undef undef undef undef undef undef undef 008 blue tdblk malcolm undef undef undef undef undef undef undef undef 133 green tdblk sharon undef undef undef undef uk undef undef undef undef undef 047 blue tdblk gill undef undef undef undef undef undef undef undef undef