[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

my immature thoughts on perl



Hello list,

I am not that familiar with perl (though I like it), but I found it maybe have two flaws as follows.

1. doesn't have an interactive shell.
2. the block statement (like lambda) is ugly.

For instance, in ruby (irb) this is quite smooth:

irb(main):001:0> [1,2,3,4].map{|x|x+1}.reduce{|x,y|x+y}
=> 14


And in scala (shell):

scala> List(1,2,3,4).map{ _+1 }.reduce{_+_}
res1: Int = 14

In perl there is no interactive shell, and the block statement seems strange:

$ perl -le '@x=(1,2,3,4); $sum+=$_ for( map {$_+1} @x );print $sum'
14


How do you think of it?

Thanks
Corey


Reply to: