good chemistry is complicated,
and a little bit messy -LW
Perl odditiesby brian_d_foy (Abbot)
|on Mar 01, 2005 at 09:58 UTC||Need Help??|
Do you have a list of things that you find odd about Perl? I'm not talking about what you don't like, but things that just don't seem to fit in, as if they were exceptions to normal Perl thinking.
Since Perl draws from so many other things, it's going to be a mish-mash of things. Perl can't very well help that libc functions do things a certain ways, or that it wanted to bridge a couple of languages. Still, there are things that make we wonder. What makes you think "Huh?" Here's three of mine:
-M, -A, and -C units
The -M, -A, and -C file test operators return the file modification, access, and creation times in days since the start of the program. Why? Why why why? Does anyone actually use the values for anything other than to compare them to each other?
mkdir() and rmdir()
The libc mkdir(), chmod(), chown(), rmdir(), and unlink() functions take the file name first, and so do Perl's mkdir() and rmdir(). However, the Perl versions of the other functions take lists of files to affect. Perl's mkdir() and rmdir() doesn't. I always want to put the directory names second in mkdir().
The Perl chown() and chmod() functions take the file names last, which is a good thing so they can affect a lot of files. To me, mkdir() breaks the rule because it's the only thing that doesn't take a list of names.
print FH @list
You don't put a comma between the filehandle name and the list you give to print. I've just always thought that was odd, and I go out of my way to point it out to people in Perl classes. I don't have a problem with this while I code, but I still think it's an odd corner of syntax.
brian d foy <email@example.com>