Thread Such-Script gesucht (15 answers)
Opened by WOtAN at 2005-08-03 12:47

WOtAN
 2005-08-03 13:01
#5377 #5377
User since
2005-08-03
12 Artikel
BenutzerIn
[default_avatar]
Achja, Entschuldigung, hab ich vergessen ;)
Achja, ich bin totaler Neuling in Perl, desswegen nicht über den code wundern ;)

Code: (dl )
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/perl
#
use CGI qw/:standard/;

$file = "lyrics.db";

$sinterpret = lc(param('interpret'));
$stitle = lc(param('title'));

print header;

print "Interpret::$sinterpret\n";
print "<BR>Title::$stitle<BR>\n";

open (SR, $file);

do
{
$rid = (<SR>);
$interpret = lc(<SR>);
$title = lc(<SR>);
$ci = 9;
$ct = 9;

if ($sinterpret ne "") {
do
{
++$i;
if (substr($interpret, $i, length($sinterpret)) = $sinterpret) {
$ci = 1;

}
else {
$ci = 9;
}
}
until ($i < length($interpret) or $ci = 1)
}
else {
$ci = 6;
}


if ($stitle ne "") {
if (length($stitle) <= length($title)) {
if ($stitle = $title) {
$ct = 1;
}
else {

for ($j = 0; $j < length($title); ++$j)
{
if (substr($title, $j, length($stitle)) = $stitle) {
$ct = 1;
}
else {
$ct = 9;
}
}
}
}
}
else {
$ct = 6;
}


# $ci / $ct Results:
#
# 9 - False
# 1 - True
# 6 - Empty

$a = $ci + $ct;

if ($a eq 7)
{
print "<BR> $rid matches - Variable returned : $a --------- $interpret - $title\n";
}

if ($a eq 2)
{
print "<BR> $rid matches - Variable returned : $a --------- $interpret - $title\n";
}

}
until (eof(SR))

View full thread Such-Script gesucht