3. Explain the difference between use and require.
"use" is at compile time, "require" is at run-time? It's weird how you code and code and only when somebody asks you something you start having questions about it :
use also calls import(). From use: Imports some semantics into the current package from the named
module, generally by aliasing certain subroutine or variable
names into your package. It is exactly equivalent to
BEGIN { require Module; import Module LIST; } - 8. What is the difference between for & foreach, exec & system?
for & foreach are now an alias to each other (Ok, one of them is implemented, but they're actually the same thing). As for exec & system, I don't use them much, so I'd have to check on documentation (and don't forget backticks, too)
for can be used as an alias for foreach, and visa-versa. But please, please don't use foreach with a C style for loop:
foreach ( loop_init(); exit_test(); increment() ) { ... }As for exec and system, one of 'em forks, one doesn't. I always forgot which one is which, and look them up, too. (exec never returns, while system does) and sometimes, I just open a pipeline.
-
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.
|