my @blackliste_gang_ohne_adress = ('Pergamentmachergang','Adler-Gang','Aegidienhof');
1 2 3 4 5
for (sort keys %gang_with_no_adress){ if ($gang_with_no_adress{$_} == 0 && in_array(@blackliste_gang_ohne_adress,$_) == 1){ $gang_with_no_adress{$_} = -1; } }#end-foreach
1 2 3 4 5 6
sub in_array { my ($arr,$search_for) = @_; my %items = map {$_ => 1} @$arr; # Zeile 1594 return (exists($items{$search_for}))?1:0; }
QuoteCan't use string ("Pergamentmachergang") as an ARRAY ref while "strict refs" in
use at C:/strawberry/perl/lib/OSM/osm_jt.pm line 1594.
Quote$VAR1 = 'Pergamentmachergang';
$VAR2 = 'Adler-Gang';
$VAR3 = 'Aegidienhof';
if ($gang_with_no_adress{$_} == 0 && firstidx($_ @blackliste_gang_ohne_adress) > 0){
my @blackliste_gang_ohne_adress = ('Pergamentmachergang','Adler-Gang','Aegidienhof');
1 2
my %blackliste_gang_ohne_adresse; @blackliste_gang_ohne_adresse{'Pergamentmachergang','Adler-Gang','Aegidienhof'} = ();
QuoteAber wie gesagt, besser wär, einen Hash außerhalb der Loop zu machen. Statt
my %items = map {$_ => 1} @$arr; # Zeile 1594
use Data::Dumper;
print Dumper \%gang_with_no_adress;
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
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %gang_with_no_adress = ( 'Pergamentmachergang' => 0 , 'Bedler-Gang' => 0 , 'Begidienhof' => 1 ); my %blackliste_gang_ohne_adress = ( 'Pergamentmachergang' => 1 , 'Adler-Gang' => 1 , 'Aegidienhof' => 1 ); for (sort keys %gang_with_no_adress){ if ($gang_with_no_adress{$_} == 0 && $blackliste_gang_ohne_adress{$_}){ $gang_with_no_adress{$_} = -1; } }#end-foreach print Dumper \%gang_with_no_adress;
if ($gang_with_no_adress{$_} == 0 && in_array(@blackliste_gang_ohne_adress,$_) == 1){
QuoteCode: (dl )if ($gang_with_no_adress{$_} == 0 && in_array(@blackliste_gang_ohne_adress,$_) == 1){