Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) 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().

int mkdir(const char *path, mode_t mode); int rmdir(const char *path); int chmod(const char *path, mode_t mode); int chown(const char *path, uid_t owner, gid_t group); int unlink(const char *path);

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 <bdfoy@cpan.org>

In reply to Perl oddities by brian_d_foy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-24 23:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found