molily: [Ruby] - Anzahl URLs in Array

Beitrag lesen

urls = ['http://google.de','http://web.de','http://gmx.de','http://authentifizierung.org']

Für eine komplette Statistik:

stats = {}
urls.each {|x| stats[x] ? stats[x] += 1 : stats[x] = 1 }

ergibt
{"http://web.de"=>1, "http://authentifizierung.org"=>1, "http://google.de"=>1, "http://gmx.de"=>1}

Mathias