Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Interview Prepration

by jhourcle (Prior)
on Apr 04, 2005 at 03:17 UTC ( [id://444575]=note: print w/replies, xml ) Need Help??


in reply to Re: Interview Prepration
in thread Interview Prepration

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://444575]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-25 15:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found