|
God, I love perl. No other language gives you the same kind of freedom to cheat and create very clever solutions to problems. Have a problem that would be best solved using a functional language like LISP? Just set no strict refs, and off you go! It is very refreshing to be able to actually program in a way that is not limited or constrained by the language. Don't listen to anyone who says that this flexibility is a negative aspect of perl, rather than a positive one. They are very wrong. I have found the camel book to be utterly useless. Its fun to read, but fails in actually being a good handbook for the language. I've found perl's man pages to be infinitely more readable, concise, and useful. For new perl programmers, the must read man page (besides perlre) is perlref. Without understanding and using references, it is impossible to harness the full flexibility of the language.
|
# ¿ Oct 25, 2007 09:27 |
|
|
# ¿ Apr 30, 2024 07:06 |
|
Stabby McDamage posted:- Subroutines can be passed as variables ("closures"). Actually, this isn't what a closure is. A closure is a logical concept that comes along with perl being a formal language: in any abstract block of code (subroutine, anonymous block), you can have free variables; that is, variables that aren't declared (lets assume that we have strict vars on) , or, in logical terms, aren't bound. Perl supports closures, in that, if that variable is bound outside of that block of code, it is considered as a constant, not a variable, in that code. For example: code:
code:
|
# ¿ Oct 25, 2007 09:46 |
|
floWenoL posted:I'm not sure what exactly you mean by "constant", but if you mean the value of the variable is fixed to whatever the value is at the time of the creation of the closure, it's not true: You're right- I got closures from formal logic mixed up with perl's implementation. floWenoL posted:I'm also not sure why you associate the behavior of "no strict refs" with functional languages, given that that is a feature shared by most, if not all, dynamic languages, functional or not. I was giving an example of perl's flexibility, not comparing it to other languages.
|
# ¿ Oct 25, 2007 21:55 |