Perl Scripting
Interview Questions And Answers
Q: - Can you suggest a quick way to find a particular string in an array element?
Iterating over the array and checking each element are the usual ways to do so. If you frequently find yourself searching an array to see whether an element is in the array, you probably didn't want to store the data in an array in the first place.A much more efficient structure for random-element access is a hash.
Submitted By:-Amrinder Email-ID: - amrinder_gill1984@rediff.com
Q: - My open statement keeps failing, and I'm not sure why. What's wrong?
First, check the syntax of the open statement. Make sure you're opening the right filename. Print the name before the open if you need to be sure. If you intend to write to the file, make sure you put a > in front of the filename; you need to. Most importantly, did you check the exit status of open by using open() || die "$!"; syntax? The die message might be very important in helping you find your mistake
Submitted By:-Amrinder Email-ID: - amrinder_gill1984@rediff.com

