Небольшое дополнение к утилите juickdiff

 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
my $i = 0;
my $cmd = `dir`; #executing os command 'dir'
my @users = ();
print "List of users, that you used early:\n";
while ($cmd =~ m/\.subscribers\.(.*)/g){ #extracting usernames from filenames
print "$i $1\n";
$users[$i] = $1;
$i += 1;
}
$cmd =~ m/(juickdiff\.pl)/i; #finding juickdiff in current folder
$juickdiff = $1;
if ($juickdiff =~ m/^\s*$/){
die "There is no juickdiff found in current folder!";
}
print "\nEnter the number of the user that you want to see:\n";
my $number = <>;
chomp $number;
if (($number =~ m/\d*/) and ($number >= 0) and ($number <= $i)){
print "\ngetting data for $users[$number] in progress...\n";
print `perl $juickdiff $users[$number]`;
} else {
print "$number is not a valid number!\n";
};