LWN.net Logo

On the future of Perl 5

On the future of Perl 5

Posted Dec 3, 2008 17:47 UTC (Wed) by tzafrir (subscriber, #11501)
In reply to: On the future of Perl 5 by jordip
Parent article: On the future of Perl 5

python modules are .py . Perl modules are .pm and not .pl .

Here:

$ locate *.pl | wc
2332 2332 159535

$ locate *.pm | wc
2652 2652 159667

$ locate *.py | wc
13245 13245 759199

$ locate *.rb | wc
545 545 21072

(From my Debian Lenny system with a similar role)


(Log in to post comments)

On the future of Perl 5

Posted Dec 3, 2008 18:18 UTC (Wed) by drag (subscriber, #31333) [Link]

This is a fairly fresh Fc10 install.

locate *.pl |wc
609 610 29121

locate *.pm |wc
604 604 28603

locate *.py |wc
4506 4506 256033

locate *.rb |wc
5 5 285

On the future of Perl 5

Posted Dec 3, 2008 18:30 UTC (Wed) by kragil (subscriber, #34373) [Link]

The amount of perl scripts in modern distros is declining. I think Red Hat and Canonical with their strong Python focus will be the first companies to phase out Perl in their base distros ( might take a few more years, but reimplementing/developing new in Python is the sane choice. Porting to Perl6 isn't IMHO ).

On the future of Perl 5

Posted Dec 4, 2008 8:55 UTC (Thu) by job (guest, #670) [Link]

I don't think the number of files with a particular extension is the question.

A better metric may be:
$ file /usr/bin/* | grep perl | wc -l
97
$ file /usr/bin/* | grep python | wc -l
80

(Repeat through $PATH.) At least on Ubuntu Intrepid this shows them on roughly equal footing.

On the future of Perl 5

Posted Dec 4, 2008 15:19 UTC (Thu) by hummassa (subscriber, #307) [Link]

Solving the dispute with a little Perl script :-)
#!/usr/bin/perl

use strict;

my %languages;
for( grep !m{^/home}, split /:/, $ENV{PATH} ) {
  for( <$_/*> ) {
    $_ = do { <F> if open F, '<', $_ };
    next unless /^#!/;
    $languages{$1}++ if /\b(perl|php|python|ruby)\d*\b/
  }
}
printf "%-20.20s  %6d\n", $_, $languages{$_} for sort keys %languages

__END__
Output (on my Kubuntu 8.04):

perl                     891
php                        2
python                   242
ruby                      40

On the future of Perl 5

Posted Dec 5, 2008 21:59 UTC (Fri) by cdmiller (subscriber, #2813) [Link]

I'm still waiting for the "equivalent" Python script to appear :)

On the future of Perl 5

Posted Dec 6, 2008 5:47 UTC (Sat) by dmag (subscriber, #17775) [Link]

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.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds