While most of your list are perl wrappers for C-library stuff (and any research you do into that is just generally useful for becoming a Unix expert) the ones that stand out to me are q qx qq qr.

Those aren't functions, they are one of Perl's syntactic superpowers! (that I wish other languages would start using) I agree that the documentation for them is rather terrible in perldoc perlfunc. You can find a much better explanation at perldoc perlop under Quote-Like-Operators.

The gist is that while you can just use backslashes to have i.e. double-quotes inside of a double-quoted string, it often looks terrible, so perl gives you the 'qq' syntax that lets you choose your own terminating character for the string. Then you can choose one that doesn't interfere with the readability of your string.

It makes even more difference when you have strings inside of strings, like:

eval qq{ print qq{This string uses "double quotes"\n}; }
instead of
eval " print \"this string uses \\\"double quotes\\\"\n\"; "

A warning though, you probably shouldn't use 'qx' in production code. It lets you choose your own quotes for ` ... ` but any time you have something complex enough that you wanted alternate quote characters to pass something to bash to execute, you are probably opening yourself up to shell injection attack vectors. It's much better to run external programs with system("progname", $arg1, $arg2, ...) where you are in full control over the boundaries of the arguments to the program, and not relying on the shell to re-parse them based on quote characters. You can capture the output of system() using Capture::Tiny.

**Edit**

So also I see 'keys', 'values', and 'each' on your list. Those are fairly important perl functions for working with hashes. And... actually the documentation is fairly good for those, so I'm not sure what else to say about them. You should practice working with them until you get the feel for it.

Finally, 'pos' is a more advanced perl feature, but lots of fun if you're writing parsers. Basically, every Perl string has a built-in position marker, and the perl regex engine can make use of that position. The 'pos' function lets you access or change the position marker. And that's really all you need to know until you decide to write a fancy parser. Then you can come back and ask more questions :-)


In reply to Re: How to find Perl demo programs? by NERDVANA
in thread How to find Perl demo programs? by harangzsolt33

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.