blob: 9667f5a2154bd592d02fa98ad894d1afa925725c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/usr/bin/perl
use XML::Simple;
use warnings;
use strict;
use Data::Dumper;
my $xml = XML::Simple->new();
my $users = $xml->XMLin("data/user.xml", KeyAttr => {});
my %l;
# Snarf through the XML data. Build a hash:
# username => lastuse
# Only for users with no items and no money.
# For some reason last_use is floating point so let's fix that.
foreach my $user (@{$users->{user}}) {
if ($user->{'used_stalls'} == 0 && $user->{'money'} == 0) {
$user->{'last_use'} = 0 unless ($user->{'last_use'});
$l{ $user->{'name'} } = int($user->{'last_use'});
}
}
print("Last used\t\t\tUsername\n");
foreach ( sort { $l{$a} cmp $l{$b} || $a cmp $b } keys %l ) {
print gmtime($l{$_}) . "\t$_\n";
}
|