Leser: 1
![]() |
|< 1 2 >| | ![]() |
12 Einträge, 2 Seiten |
Wie frage ich & perlintro
brian's Leitfaden für jedes Perl-ProblemQuoteFETCHING A LIST OF KEYWORDS FROM THE QUERY:
@keywords = $query->keywords
If the script was invoked as the result of an <ISINDEX> search, the parsed keywords can be obtained as an array using the keywords() method.
FETCHING THE NAMES OF ALL THE PARAMETERS PASSED TO YOUR SCRIPT:
@names = $query->param
If the script was invoked with a parameter list (e.g. "name1=value1&name2=value2&name3=value3"), the param() method will return the parameter names as a list. If the script was invoked as an <ISINDEX> script and contains a string without ampersands (e.g. "value1+value2+value3") , there will be a single parameter named "keywords" containing the "+"-delimited keywords.
NOTE: As of version 1.5, the array of parameter names returned will be in the same order as they were submitted by the browser. Usually this order is the same as the order in which the parameters are defined in the form (however, this isn't part of the spec, and so isn't guaranteed).
my @price; m/^preis(\d+)/ and $price[$1] = $q->param($_) for $q->keywords();
1
2
3
4
5
6
my @price;
foreach($q->keywords()){
if($_ =~ m/^preis(\d+)/){
$preis[$1] = $q->param($_);
}
}
1
2
3
4
5
6
7
my @preis;
foreach my $keyword ($q->keywords()) {#durchlaufe alle übergebenen Paramter
if ($keyword =~ m/^preis(\d+)/) {#Wenn der aktuelle Parameter name mit preis und einer
#Zahl beginnt schreibe die Zahl in die spezialvariable $1
$preis[$1] = $q->param($keyword);#Weise dem Arrayelement $1 den Wert von $keyword zu
}#if
}#foreach
![]() |
|< 1 2 >| | ![]() |
12 Einträge, 2 Seiten |