Hi Jenn.

Its interested ;)

How's it?

#!/usr/bin/ruby

regex = /href="http:\/\/(.*?)\/.*" target="_blank"/

File.open("index.html") do |f|
  f.each_line do |c|
    puts $1 if c =~ regex
  end
end

2010/1/4 Ruby Newbee <rubynewbee / gmail.com>:
> Hi,
>
> I wrote this message without other purpose, just show a result for
> comparison. :-)
>
> First I got the page which will be used for analysis (got all domain
> names from it):
>
> wget http://www.265.com/Kexue_Jishu/
>
> It will get an index.html page.
>
> Then I run this ruby script:
>
> #!/usr/bin/ruby
>
> f = File.open("index.html")
>
> f.each_line do |c|
>    潢ܯܯܯ 뢯  > end
>
> f.close
>
>
> And this perl script:
>
> #!/usr/bin/perl
>
> open HD,"index.html" or die $!;
> while(<HD>) {
>    潢ܯܯܯ 뢯> }
> close HD;
>
>
> When using "time" command to see the running time, I saw ruby is
> slower than perl (maybe due to the regex?).
>
> Ruby's:
>
> real m0.013s
> user m0.012s
> sys 0m0.000s
>
> Perl's:
>
> real m0.004s
> user m0.004s
> sys 0m0.000s
>
> Both versions:
>
> # ruby -v
> ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]
>
> # perl -v
> This is perl, v5.8.8 built for i486-linux-thread-multi
>
>
> Yes that's the result, but not influence me to love ruby.
>
>
> Thanks.
> Jenn.
>
>