On the future of Perl 5
Posted Dec 6, 2008 5:47 UTC (Sat) by
dmag (subscriber, #17775)
In reply to:
On the future of Perl 5 by hummassa
Parent article:
On the future of Perl 5
Oh, please, let's not have a language flame war on LWN.
Besides, Ruby is much better :)
#!/usr/bin/ruby
is_home = lambda {|path| path =~ /^\/home/ }
languages = Hash.new(0) # Default value is zero
ENV['PATH'].split(/:/).reject(&is_home).each do |one_path|
Dir[one_path + "/*"].each do |binfile|
File.open(binfile,"r") do |data|
first_line = data.gets
languages[$1] += 1 if first_line =~ /\b(perl|php|python|ruby)\d*\b/
end rescue puts "#{binfile} unhappy"
end
end
languages.each_pair do |language, count|
puts "%-20.20s %6d" % [language, count]
end
__END__
Output from Slackware 12.0 (with lots of rubygems installed):
php 1
python 62
ruby 79
perl 203
For comparison: (sh|bash|tcsh|csh|ash|ksh|zsh|fish)
sh 488
bash 22
ksh 1
csh 1
Of course, we're not really measuring anything useful here. For example,
git used to install tons of commands in /usr/bin. This could tilt the scales (if it were written in one language).
Seriously, I doubt that Ruby (or even Python) will unseat Perl from it's sysadmin tool niche, which is what we seem to be measuring here. Since every distro has bash and perl, that's what people tend to use.
On the other hand, I think Ruby (and perhaps Python) has already unseated Perl from web scripting, where the client doesn't care what language the server is written in.
(
Log in to post comments)