magento
asked on
Perl help
Hi,
I attended an interview today and they asked me the below questions. Please help on them.
1. How to sort an array without using built in?
2. How to sort an hash with values ?
3. Tell the login for permutation in Perl?
4. Regex for email address, web url , state-city-zipcode format
5. what is the difference between ./test.pl and perl test.pl ?
Thanks
I attended an interview today and they asked me the below questions. Please help on them.
1. How to sort an array without using built in?
2. How to sort an hash with values ?
3. Tell the login for permutation in Perl?
4. Regex for email address, web url , state-city-zipcode format
5. what is the difference between ./test.pl and perl test.pl ?
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Interesting. I never noticed that before. It's definitely contrary to what I would expect (and, iirc, normal shell processing mechanics (but it's been a long time since I've done much shell scripting so I may be misremembering)).
from `perldoc perlrun`
The "#!" line is always examined for switches as the line is being parsed.
...
If the "#!" line does not contain the word "perl" nor the word "indir"
the program named after the "#!" is executed instead of the Perl
interpreter. This is slightly bizarre, but it helps people on machines
that don't do "#!", because they can tell a program that their SHELL is
/usr/bin/perl, and Perl will then dispatch the program to the correct
interpreter for them.
But I would not consider it reasonable to expect knowledge of such details on an interview question unless the interviewee is given access to the man pages
The "#!" line is always examined for switches as the line is being parsed.
...
If the "#!" line does not contain the word "perl" nor the word "indir"
the program named after the "#!" is executed instead of the Perl
interpreter. This is slightly bizarre, but it helps people on machines
that don't do "#!", because they can tell a program that their SHELL is
/usr/bin/perl, and Perl will then dispatch the program to the correct
interpreter for them.
But I would not consider it reasonable to expect knowledge of such details on an interview question unless the interviewee is given access to the man pages
ASKER
Dear Experts,
Thank you so much for your time . I am going thru the answers.
The question 3 is , they asked me to show logic in perl to do the combination ...
Thanks
Thank you so much for your time . I am going thru the answers.
The question 3 is , they asked me to show logic in perl to do the combination ...
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
3) I'm still not sure I understand. Do you want permutation or combination? And would you want a singular one (if so, which) or plural all (if so, in what order)? And which logic?
ASKER
Hi Ozo ,
Sorry i really dont know this . This was asked to me in an internal interview. So i thought of learning the answers from experts.
I think they asked me how you will do permutation logic in perl .
Thanks
Sorry i really dont know this . This was asked to me in an internal interview. So i thought of learning the answers from experts.
I think they asked me how you will do permutation logic in perl .
Thanks
You might do a particular permutation like
@a=@a[1,4,3,2,0];
@a=@a[1,4,3,2,0];