Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Interview questions

by amexmythili (Novice)
on Dec 18, 2011 at 02:53 UTC ( #944149=perlquestion: print w/replies, xml ) Need Help??

amexmythili has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

While attended an interview they asked this question. I don't know how to answers for this. Will any body explain this.

(i.e.)

1) What will happen if the perl file(*.pl) having the below text only.

my $test;
our $test;
local $test;

2) If you setup a custom Perl repository of Modules for your code, what environment variable should be set to the path for this repository, so that your modules can be used in Perl scripts on the system?

Any one can help me to know about this.
Thanks and regards, Mythili

Replies are listed 'Best First'.
Re: Interview questions
by ww (Archbishop) on Dec 18, 2011 at 03:40 UTC
    1) Nothing -- it's a trick question.

    2) Do a bit of searching. Try such terms as "@INC" and lib or read the perlfaq8 FAQ sections.

    True laziness is a virtue; lazily asking others to find answers to well-documented facts is not.

      1) Nothing -- it's a trick question.

      Well, nothing important, but it does have an effect

Re: Interview questions
by eyepopslikeamosquito (Bishop) on Dec 18, 2011 at 10:56 UTC

    1) I don't like trick questions. I think a better question is: explain the difference between "my" and "our" and "local".

    2) I feel using environment variables for this is rather crude. Extra points if you ask the interviewer: a) under what circumstances are PERL5LIB and PERLLIB ignored? b) what are alternative ways to do this?

Re: Interview questions
by Anonymous Monk on Dec 18, 2011 at 03:08 UTC
Re: Interview questions
by cdarke (Prior) on Dec 19, 2011 at 11:27 UTC
    1). Depends if the program is run with warnings on or not (-w option). If it is then:
    "our" variable $test masks earlier declaration in same scope
    More likely the interviewer wanted you to say what the difference between my, our, and local is.

    2). The interviewer probably wanted PERL5LIB or PERLLIB, but actually any environment variable could be used to set the path provided you
    use lib $ENV{varname};


    Did you get the job?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (1)
As of 2021-12-07 04:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (33 votes). Check out past polls.

    Notices?