Perl interview answers

2 min
6
0
0
Published on updated on
  1. How do you know the reference of a variable whether it is a reference, scaller, hash or array?

    There is a 'ref' function that lets you know

  2. What is the difference between 'use' and 'require' function?

    Use: 1. the method is used only for modules (only to include .pm type file) 2. the included object are verified at the time of compilation. 3. No Need to give file extension. Require: 1. The method is used for both libraries (package) and modules 2. The included objects are verified at the run time. 3. Need to give file Extension.

  3. What is the use of ‘chomp’? What is the difference between 'chomp' and 'chop'?

    'chop' functionality removes the last character completely 'from the scaler, where as 'chomp' function only removes the last character if it is a newline. by default, chomp only removes what is currently defined as the $INPUT_RECORD_SEPARATOR. whenever you call 'chomp ', it checks the value of a special variable '$/'. whatever the value of '$/' is eliminated from the scaler. by default the value of '$/' is 'n'

  4. Print this array @arr in reversed case-insensitive order

    @solution = sort {lc $a comp lc$b } @arr.

  5. What is '->' in Perl?

    It is a symbolic link to link one file name to a new name. so lets say we do it like file1-> file2, if we read file1, we end up reading file2.

  6. How do you check the return code of system call?

    System calls "traditionally" returns 9 when successful and 1 when it fails. system (cmd) or die "Error in command";

  7. How to substitute a particular string in a file containing million of record?

    Perl -p -ibak -e 's/search_str/replace_str/g' filename

  8. I have a variable named $objref which is defined in main package. I want to make it as an object of class XYZ. How could I do it?

    Use XYZ my $objref =XYZ -> new() OR, bless $objref, 'XYZ';

  9. What is meant by a 'pack' in perl?

    Pack converts a list into a binary representation. Takes an array or list of values and packs it into a binary structure, returning the string containing the structure. It takes a LIST of values and converts it into a string. The string containing a con-catenation of the converted values. Typically, each converted values looks like its machine-level representation. For example, on 32-bit machines a converted integer may be represented by a sequence of 4 bytes.

  10. How to implement stack in Perl?

    Through push() and shift() function. push adds the element at the last of array and shift() removes from the beginning of an array.

    Click on the link to search and apply for Perl jobs

    Answers sourced from www.techinterviews.com

Continue reading around the topics :

Comment

In the same category

The best IT jobs for introverts IT Career Advice
Introverts can thrive in IT jobs that require focus, problem-solving, and independent work. There are plenty of roles perfect for those who prefer working behind the scenes.
4 min
data jobs in the UK IT Career Advice
Data jobs in the UK are in high demand, with roles in data science, engineering, and analysis offering excellent career stability. From junior data analysts to senior roles like chief data officer, these positions provide clear growth opportunities with salaries ranging from £25,000 to £100,000+
3 min
Preparing for your Junior Data Analyst interview IT Career Advice
Interviews for a Junior Data Analyst role can be challenging, but preparation is key. Be ready to discuss tools like Excel, SQL, and Python, and share how you've used them in projects. This guide covers key questions and tips to help you feel confident.
4 min

Connecting Tech-Talent

Free-Work, THE platform for all IT professionals.

Free-workers
Resources
About
Recruiters area
2024 © Free-Work / AGSI SAS
Follow us