All pastes #176519 Raw Edit

Something

public ruby v1 · immutable
#176519 ·published 2006-09-19 18:38 UTC
rendered paste body
Working=require 'net/http'pages = %w( www.rubycentral.com        www.awl.com        www.pragmaticprogrammer.com        www.mattiaslovkvist.se        )threads = []for page in pages        threads << Thread.new(page) { |myPage|                h = Net::HTTP.new(myPage, 80)                puts "Fetching: #{myPage}"                resp, data = h.get('/', nil )                puts "Got #{myPage}: #{resp.message}"        }endthreads.each { |aThread| aThread.join }Not working =require 'net/http'pages = %w( www.rubycentral.com        www.awl.com        www.pragmaticprogrammer.com        www.mattiaslovkvist.se        )threads = []pages.each { |page|        threads << Thread.new(page) { |myPage|                h = Net::HTTP.new(myPage, 80)                puts "Fetching: #{myPage}"                resp, data = h.get('/', nil )                puts "Got #{myPage}: #{resp.message}"        }}threads.each { |aThread| aThread.join }