Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Contact Information: Career Objective

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 62
At a glance
Powered by AI
The candidate has extensive experience as a Perl programmer and has worked on projects involving web development, testing, and data processing. They have skills in Perl, PHP, MySQL, Linux, and version control systems.

The candidate has skills in Perl, PHP, object-oriented programming, MySQL, Linux environment, shell scripting, and database development. Their experiences include roles as a Perl programmer at Atradius, IBM, and BakBone Software.

The candidate has held positions as a Perl programmer at Atradius Credit Insurance NV from August 2009 to March 2010, at IBM UK Laboratories from July 2007 to May 2009, and at BakBone Software from January 2007 to July 2007.

Contact information

Michael M. Naccarat

4611 Nelm Street


Hyderabad – 22102

Career objective

Looking for a challenging position of the Perl Programmer in the reputed company with a
view to use my wide experience for the benefit of the organization.

Skills

• Experience working in a Linux environment


• Object Oriented PHP
• Object Oriented Perl
• MySQL work bench MySQL Browser and MySQL Administrator
• To administer local host and production websites
• Shell scripting
• Normalized database development

Experience

August 09 to March 2010

Atradius Credit Insurance NV, Cardiff Bay

Perl Programmer

• Development, support and maintenance of Perl CGI web service and backend Perl
scripts for software migration through strategic test environments.
• Use of Perl CGI, Javascript, jQuery, HTML, CSS, cygwin Unix, Bash shell on
AIX, Oracle 9/10 SQL, Object Orientated Perl programming, CVS, Remedy,
PVCS, PuTTY and ActivePerl.
• Successful deployment of major improvements to web service user experience,
liaising with non-IT departments. Created user role administration via web,
implementing improved software maintenance, version control, test environments
and documentation. Arranged Perl training and created support documentation for
their Perl processes.
• Implementation and process control of many change requests to the migration
system as business needs changed. Security improvements. Production code
delivery management.
July 07 to May 2009

IBM UK Laboratories, Hursley

Perl Programmer

• Development of software for formally testing IBM SAN Volume Controller


(SVC) new function before major release in Perl, ksh and bash on AIX and Linux.
• Successful deployment of Perl scripts and libraries for use by international test
teams.
• Testing SVC in regression, stress, white/black box and system test using Perl test
automation software suite, with data gathering, analysis and defect reporting.
• Configuration of SVC, Linux/Windows/AIX hosts in Fiber Channel SAN test
stands. Installation of AIX, Windows and Linux operating systems.

January 07 to July 07

BakBone Software, Poole

Perl Programmer

• Bug fixing of C/C++ multi-threaded backup system using Jira defect tracking
software and CVS configuration management tools.
• Build management for internal and external software releases.
• Installation of SuSE Linux systems under VMware and support for other
developers’ Linux systems.
• Perl utility scripting.

Education

• University of Surrey

BSc(Hons) in Electronic and Electrical Engineering

• University of Surrey

NVQ3 in Business

References

Floyd P. Olivier
Manager
Wap Company.
Floyd_oliver@gmail.com
Not getting feedback on Perl Programmer jobs? It’s probably your Perl Programmer
resume. Here’s a better approach.

Kenneth Bell
1360 E Gardena Rd
Geneva, AL 36340
(777)-524-6575
k.bell@emailaddress.com

Job Objective: Seeking a challenging position as a Perl Programmer where my


Programming skills and knowledge will add value to organization.

Work Experience:

Perl Programmer, August 2005 - Present


AtPac, Geneva, AL

Determined and recommended on improving overall data capture, price validation and
data set release process.
Responsible for supporting our groups' Web applications and associated relational
database using Unix/Linux-Perl, CGI, CSS, Java script, CVS, Sybase.
Developed tools to aid in streamlining and automating production work, and provided
data, technical, and analytical support to the company operations.
Worked on applications where large amounts of data is being taken in and needs to be
analyzed, processed, and reported.
Participate in the implementation of policy and standards for wire line network security.
Identified new vulnerabilities, researched their affect on the business and mitigation
required.

Summary of Qualifications:

Profound knowledge of Perl development


Sound knowledge of developing front end code for a rich internet application using
JavaScript and HTML
Extensive knowledge of developing back-end code in PHP/Perl, XML and MySql
Deep knowledge of object oriented development - Perl, C++ and Java
Operational knowledge of Linux, UNIX and networking
Excellent written and oral communication skills
Solid programming and development skills
Ability to think logically and have good communication skills
Ability to perform programming, debugging, data analysis and system analysis
Education:

Bachelor’s Degree in Computer Engineering, Western Connecticut State University,


Connecticut, CT

Perl Programmer Resume


If you are applying for the position of Perl Programmer and waiting for a
strong and optimized resume, then we will help you in preparing strong resume for your
job application. Here, we have provided one optimized and effective resume sample. You
can copy and edit this sample for preparing your own resume. It will help you in making
your resume attractive and optimized.

Please feel free to customize this resume sample while writing your resume.

Henry Thompson
1638, Madison, Washington- 459369, Home- (189) 25246809
henrythompson@yahoo.com

Objective:

Result-oriented and highly qualified professional looking for the position of Perl
Programmer in an organization where I will get an opportunity to utilize my skills and
knowledge to benefit the company

Qualification Summary:

Hard working and self-motivated professional with more than 13 years of experience of
programming field, strong knowledge of programming language, knowledge of database
management and administration, excellent technical knowledge, other Core Skills are:

• Excellent Written and Oral Communication Skills


• Knowledge of System Engineering Process
• Strong Leadership Skills
• Excellent Technical Knowledge
• Strong Interpersonal Skills

Professional Experience:

ABC Computers, Madison


From 2004 to present
Perl Programmer

Working as a Perl Programmer and handling all the duties and work assigned to this
position efficiently, these duties are as follows:

• Handling various duties like building critical scripts, enhancing specifications,


developing, designing, coding computer applications and programs
• Responsible for maintaining client server applications and debugging applications
• Responsible for solving problems and queries of the customers and
troubleshooting them
• Handling various projects and completing them with the help of senior
programmers

XYZ Technologies, Madison


From 2000 to 2004
Perl Programmer

Handled all the duties and responsibilities of Perl programmer position, these duties and
responsibilities are as follows:

• Worked with project managers and handled various programming projects


successfully
• Responsible for various duties and activities like designing code modules,
debugging, developing and writing specifications for applications
• Responsible for testing and analyzing computer applications by using knowledge
of Perl programming
• Maintained a good rapport with the customers and understood their requirements
to make changes in applications

SK Computers, Madison
From 1996 to 2000
Programmer

Worked on the position of programmer and handled all the duties and responsibilities
assigned to this position successfully, these duties are as follows:

• Handled various duties and tasks related to programming like designing,


developing, coding, writing specifications, debugging and so on
• Handled various programming projects and completed them successfully
• Communicated with the clients to understand their requirements/suggestions and
made changes in applications according to their suggestions
• Provided support and help to the junior programmers

Technical Knowledge:

• Knowledge of Programming Languages: HTML, DHTML, XML, Java,


JavaScript, C/C++, COBOL, Perl, C#
• Database Servers: MS Access, My SQL, SQL 2000, DB2, Oracle
• Operating Systems: Windows XP/Vista, Unix, LINUX
• Software Tools: Dreamweaver, Robohelp, Adobe Photoshop, MS Office, MS
Outlook
• Internet Proficiency

Education:

• Master’s Degree of Science in Information Technology from Washington


University in 1996
• Certification in Programming Languages in 2000

Perl Developer Resume


Perl developer must have through knowledge of Perl and have Advertisement
developed production code in it. He should have knowledge of
MySQL or equivalent databases, Solaris, Linux, Apache, SSL, HTTP,
SOAP, XML, CVS, and many more software.

The person should be self motivated and is able to set and achieve
goals and creative. He must be a good communicator who can express
ideas to other team members. He should have deep knowledge of
commonly used data structures, code design layouts and algorithms,
with a high degree of focus on flexibility, maintainability, clock cycle
and latency optimization.

The sample Perl developer's resume will help you to build your own
resume for applying to the job Perl developer.

Sample Perl Developer Resume


Richard Anderson
1234, West 67 Street,
Carlisle, MA 01741,
(123)-456 7890.

Summary:

Strongly curious, self-motivated, compulsive, enjoys challenges and perfectionist


tendencies with ability to compromise to practical realities. Experience in the Perl
development filed also familiar with Unix Shells. Posses the ability to meet sensitive
deadlines, manage time, and assume ownership of responsibilities.

Work Experience:

Shoebuy.com, Inc, Mexico, MO


Perl Developer

• Interactively worked with development team and project managers to develop


new features and functionality, on both sides of backend scripts and web based
scripts.
• Work together with graphic designers and user interface to apply intuitive and
appealing front-ends to Perl, web-based functionality.
• Refract, revise and maintain existing code with some focus on improving,
security, performance, modularity, and maintainability.
• Actively taken part into all the phases of the development life-cycle including
design, architecture, implementation, release, unit testing, refractoring and
maintenance.
• Help in the creation of carefully and clearly planned specifications that address
the entire user interfaces, businesses requirements, performance, process flow,
and scalability.
• Implement and recommend new open source toolkits, frameworks, development
processes, modules, standards or related material with the ability to guide other
developers in these areas.

Web Services Group, Cabool, MO


Jr. Applications Programmer
• Worked with the team chargeable for developing interactive database-driven
applications such as distance education, reporting, document management, online
database access, and others for user specifications.

Environments: Perl, Java, VBA/ASP, Solaris, bash, NT 4, Microsoft Access.

Education:

University of Missouri, MO
Bachelor's degree Computer Science.
Sample Perl Programmer Resume

This sample perl programmer resume will give you a quickstart on building an effective
and optimized resume for your job application. Visitors can feel free to customize and
edit our sample perl programmer resume as per their requirement for job application. We
hope that our sample perl programmer resume will go a long way in portraying your
abilities and skillsets efficiently.

Jeff Orton,
65, West 88 Street,
Burlington, Washington, 09856,
(006)-448 6598

SUMMARY OF QUALIFICATION:

Experienced in the field of perl programming with the in-depth knowledge of web
technologies. Looking for a company which can give me an opportunity of competent role
of perl programmer to utilize and enhance the skills, innovative ideas and knowledge.

SKILLS:

• Experience of last 8 years in perl programming and web technologies.


• Expertise in HTML, CSS, JavaScript, Unix Shell Scripting.
• In- depth knowledge of RDBMS, Oracle9i, TCP/IP.
• Great ability to write clear, maintainable and efficient codes for web development.
• Exceptionally good in communication, interpersonal and presentation skills.

PROFESSIONAL EXPERIENCE:

Perl Programmer
Spring Tech Inc., Burlington, Washington
2005-present

• Responsible for analyzing, designing and coding of the applications by utilizing the
perl.
• In the software development life cycle responsible for the Development and
maintenance phase of the project.
• Deals with the technical problems and fixed the bugs.
• Recommendation and also implementation of the new toolkita, modules, standards,
framework and processes.
• Worked with the team of database and maintained the database with the help of the
Oracle 9i.

Application Programmer
Creative Web Tech Co., Hampton, Virginia
2001-2005
• Responsible for the development of the database applications like database access,
database management, triggers, reports, etc. in a team.
• Worked in a team of graphic designers and script writers.

EDUCATION:

University of Virginia, Virginia


Bachelor of Information Technology

REFERENCE:

Mr. Adam Jerico


Director
Spring Tech Inc., Burlington, Washington

Sybase dba sample resume


SUMMARY : Over 10 years in Sybase Database Administration, Support of which 4 4
years in Database Development and 6 6 years are in Database Administration of huge
databases on Sybase ASE on SUN, MS-SQL Server on Windows NT in multiple
locations. Supported multiple server and database on 24 X 7 environments. Responding
to usres and developer issues

Database Administration : Monitor the databases to optimize database performance,


resource use and physical implementations of databases. Checking for database
consistency, fixing DBCC errors, monitoring of error logs regularly, monitoring of
database space allocations, transaction log space allocations .I was responsible for
Creating and testing of Database Backup Procedures, Disaster Recovery procedures

Sybase server Installation : Installed Sybase servers version 10 11.0 11.5 11.9 ASE 12.0
ASE 12.5 and 12.5 .x on SUN, SCO UNIX System and applied required patches by
monitoring new patch releases.

Replication Server : Worked on Replication Server in 24 X 7 environments.

Database creation : Created logical data models and translate into physical database
structures that integrate with existing or proposed database structures. Verify if they meet
the required parameters. Created tables, index, views, triggers, procedures, user groups,
users and assign permissions based on requirement for.

Performance tuning : Reduced the data retrieval time considerably by binding frequently
used object to memory pool, Created Stored Procedures optimized for performance at
query level and modified existing queries for optimum performance. Optimized bcp for
large data loads with sp_configure.

Monitoring memory, CPU utilization, disk utilization, locks, deadlocks and runtime of
queries.

Database Security : creating user logins with appropriate roles, dropping and locking the
logins, monitoring the user accounts, creation of groups, granting the privileges to users
and groups, assigning the users to particular groups.

Documentation : Created or updated documents for the application.

SQL Programming : Created database objects as required by the application, modified


objects for better performance and change in requirements. Working with developers on
issues creating efficient queries, application design, Data Modeling and writing stored
procedures, triggers. Extensively worked on developing and coding backend stored
procedures on Sybase, Unix

Shell Scripting : Created scripts for Monitoring and Maintenance task, automated
Database and transaction dumps, monitoring data received at 15 min interval was
received and populate reporting tables.

Perl Scripting : Used Perl for transfering data, gathering performance data like op, ostat,
vmstat, sp_sysmon.

Database Backups : Writing Backup scripts for automated dumps of full and transaction
dumps of databases, bcp out the rows into files from tables to happen at a scheduled time,
Perform manual backup when regular scripts fail.

Worked on new System 12.5 features like cache partitioning, quiesce database, disable
triggers, user defined login security, query tuning by using merge joins, taking server
engines offline, using ansi joins, using reorg rebuild on indexes and high performance
backup and restore. Dump, Loading across multiple platforms.

Dbartisan, Sybase Central, SQL Programer, Veritas netbackup, ER win, Toad and Visio,
Oracle Enterprise Manager, ARS Remedy, Sybase Direct Connect, Exceed, TSQL, ISQL,
BCP, Replication Server Manager, SQL Plus, SQL Loader, Exceed, putty.

Employment
2005 - 2006
Role : Sybase DBA
Client : TELCOVE USA Role : Sybase DBA

Hardware and Software : Sybase ASE 12.5 on SUN, Sybase 11.9.2 on SUN

Responsibilities :
Managed 1 Production Server 4 devlopment servers.

Provided DBA support to upgrade ARS Remedy from 4.0.3 to 4.5

Upgraded Sybase server 11.9.2 to 12.5 in development and documented the steps,
configured memory, procedure and data cache.

2005 - 2005
Role : Sybase DBA
Client : Hilton Hotels USA Role : Sybase DBA Client : TELCOVE USA Role : Sybase
DBA

Hardware and Software : Sybase ASE 12.5.1 on AIX, Korn Shell scripting, Sybase 11.9.2
on SUN

DBA Responsibilities :
Managed 1800 Production Databases across 4 Servers.

Provide 24 X 7 Pager support for Production Servers.

Monitor dumps, DBCC, update stats task run to completion.

Provide DBA Support to Business Analysts and Development Teams. Solved swap space
issue, deadlock issue.

Performing Benchmarks and fine tuning Sybase 12.5 ASE Servers.

Performance monitoring - Monitoring memory, CPU utilization, disk utilization, locks,


deadlocks, runtime of queries.

Configuring 12.5 ASE Server level configurations. Producing over 4 - 5% increase in


Server and batch process performance reducing run time by half.

Using sp_sysmon to evaluate server level performance. Tuning configuration and server
parameters.

Monitoring performance of servers and databases. Tuning the database by setting various
initialization parameters.

Housekeeping Sybase, dump directories.

Data migration using BCP utility.

Maintaining database backup and recovering from system database failure

Maintaining user, group, assigning privileges

Handling DBCC output and troubleshooting

Monitoring and optimizing database performance.

Script writing and editing for Sybase related batch jobs.

2004 - 2005
Role : Sybase DBA
Client : AT and T USA Role : Sybase DBA

Hardware and Software : Sybase 12.5 .x on SUN, Korn Shell scripting.

DBA Responsibilities :
Deliver new Sybase environments for Development, Testing and Training.

Provide 24 X 7 Pager support on rotation basis.

Monitor Scheduled task run to completion.

Test Pre Production installation of new changes to configuration, Monitoring scripts.

Provide DBA Support to Development Teams and testing Teams 28 data Servers.

Provide DBA Support to Reporting teams 4 data servers.

Script writing and editing for Sybase related batch jobs.

Data migration using BCP utility.

Involved in planning for disaster recovery procedures and writing shell scripts to move
data across servers.

2002 - 2004
Role : Sybase DBA
Client : Star Securities INDIA Role : Sybase DBA

Hardware and Software : Sybase ASE 12.5 on SUN Solaris, Rep Server 12.1 on SUN
Solaris, MS-SQL, Shell scripting, Perl 5.6.

I was part of a 5 member Sybase dba team.

Responsibilities :
Managed 5 Production Servers and 20 Development Servers.

Move the data from SQL Server to Sybase using bcp.

Used Perl to import tables into Sybase.

Write triggers for application Auditing requirement.

Write shell and Perl scripts to transfer data from Sybase to text files for reporting.

Test and implement the application in coordination with the Business teams.

Check and tune the performance of the Procedures with appropriate Index Strategy and
statistics.

Monitor Sybase dataservers and replication server for performance.

Worked on new System 12.5 features like cache partitioning, quiesce database, disable
triggers, user defined login security, query tuning by using merge joins, taking server
engines offline, using ansi joins, using reorg rebuild on indexes and high performance
backup and restore.

Designing the distributed environment by using architectures supported by Sybase


Replication Server. Identifying tables, columns that need to be replicated from primary to
replicated database. Creating replication definitions and subscriptions for the distributed
environment.

2000 - 2002
Role : Sybase DBA
Client : GREAT RIVER ENERGY USA Role : Sybase DBA

Hardware and Software : Sybase 11 .x, 12 .x, SUN Solaris, MS-SQL Server, Oracle,
Veritas Netback up, Shell scripting.

Worked as DBA consultant for GREAT RIVER ENERGY for 24 months and was
responsible for shell scripting, coding stored procedures and database maintenance.
Involved in the following projects as part of a development team : -
Responsibilities :
Managed 2 Productions and 1 Development.

Created auditing tables with trigger for Security.

Monitor Database Backup and Transaction Dump took Place.

Monitor live data feeds

Created scripts to monitor the data load across servers and report for failure, so the data is
populated manually.

Created the procedures to populate the summary tables hourly, daily and monthly basis
run thru cron task.

Migrated 2 databases from Sybase to oracle.

Migrated 1 database from MS-SQL server to oracle.

Created shell scripts for database backups, transaction dumps thru cron job.

Reduced the data retrieval time considerably by binding frequently used object to
memory pool.

Modified existing queries for faster data retrieval time.

Configured the DBCC database and set up to run DBCC checkstorage. Used the new
dbcc checkverify.

Created test database for development with required table and index as required.

Created production database as required for moving the test systems for production.

Develop and manipulate large, complex data sets and maintain large databases.

Monitor 3 OLTP servers for optimum performance.

Created views for users to view the data with detailed description.

Monitor success or failure of Database backups and log dumps.

Worked with mission critical databases which required less than 15 minutes of recovery
from system failure.

Document the tables, views and procedures used.


1993 - 2000
Sterling Holiday Resorts INDIA

Miscellaneous

Role : DBA, Developer

Hardware and Software :


Sybase System 10 .x, Sybase ASE on Sun Solaris, SCO UNIX, MS SQL Server 7.0 6.5
TSQL, Power Builder 5.0/4.0/3.0perl, C-shell, AWK, Sybase Central, Erwin, Power
designer, Perl.

Worked as part of 4 member database team in the design, development, testing and
implementation of Customer oriented processing system, Resort Management System,
Financial management system, Human Resource Management System using Sybase 10
and upgraded to 11.9.2 on a UNIX server. Worked on 24 X 7 environments with support
for Unix Administrator tasks. These systems handle all the transaction related
requirements of the company.

Responsibilities :
Created Database Schema, development, administration and testing using Sybase System
10 .x or 11 .x Servers, MS-SQL 6.5 7.0 Server.

Involved in maintaining 24 x 7 data access or report for various clients of the company
using Sybase, Oracle, MS_SQL server and access.

Provide 24 X 7 environments for mission critical OLTP.

Monitor Sybase dataservers and replication server for best performance.

coded stored procedures, triggers, table creation and indexes in Sybase and MS-SQL
servers.

Responsible for development, testing, implementation and administration of Human


resource System where the Employee details, Payroll accounting are handled.

Responsible for development of reporting procedures for clients which involved transfer
of data from Sybase to oracle, MS_SQL server of the clients.

Testing of applications for performance, data integrity and validation issues.


Data Transfers between various servers using BCP, import export in MS_SQL server.

Maintain availability and integrity of databases through multiple access schemes ;


facilitate sharing of common data by overseeing proper key and index management.
Monitor the databases to optimize database performance, resource use and physical
implementations of databases. Involved in creating, testing and implementing Database
Backup Procedures, Restoration Procedures, Disaster Recovery procedures and
Contingency plans.

Created logical data models and translated into physical database structures that integrate
with existing or proposed database structures. Verify if they meet the required
parameters. Created tables, index, views, triggers, procedures, user groups, users and
assign permissions based on requirement for. Working with various business groups
while developing applications, phasing from development to testing and to Production
environment in Sybase.

Reduced the data retrieval time considerably by binding frequently used object to
memory pool, modified queries for optimum performance.

Keeping logs and database objects on separate devices to achieve improved performance
and recovery.

Placing a table on 1 hard disk and non clustered indexes on another to ensure faster and
parallel reads, writes.

Query plan analysis using show plan to avoid table scans.

Reviewing database design to avoid usage of variable length data type, null data values
etc. to prevent deferred updates when possible.

Usage of proper fill factor values in the create table statement to improve performance.

Reorganization of table by rebuilding its clustered indexes after high volume inserts,
updates, deletes.

Creating temporary tables for reducing the number of table joins.

Installed Sybase servers version 10 11.0 11.5 and 11.9 on SUN, SCO UNIX System and
applied required patches by monitoring new patch releases. Traveled extensively to
install and troubleshoot Sybase and UNIX servers.

Create or update documents for the application.

Created user logins with appropriate roles, dropping and locking the logins, monitoring
the user accounts, creation of groups, granting the privileges to users and groups,
assigning the users to particular groups.
Mirroring devices, checking for database consistency, fixing DBCC errors, monitoring of
error logs regularly, monitoring of database space allocations, transaction log space
allocations, fine tuning SQL performance, backing up of transaction logs, backing
databases regularly, database segmentation for fine performance.

Migrated 5 applications from Oracle to Sybase as part of a team of 4 DBAs and to


provide support and upgrades to existing oracle application during migrating period.

Used Perl for coding scripts to manupulate data for transferring for Sybase to SQL server
for reporting.

PERL SCRIPTING INTERVIEW QUESTIONS


 Does Perl have reference type?
 How do I do < fill-in-the-blank > for each element in a hash?
 How do I do < fill-in-the-blank > for each element in an array?
 How do I do fill_in_the_blank for each file in a directory?
 How do I generate a list of all .html files in a directory?
 How do I print the entire contents of an array with Perl?

 How do I read command-line arguments with Perl?


 How do I replace every character in a file with a comma?
 How do I send e-mail from a Perl/CGI program on a Unix system?
 How do I set environment variables in Perl programs?
 How do I sort a hash by the hash key?
 How do I sort a hash by the hash value?
 How do you find the length of an array?
 How do you give functions private variables that retain their values between calls?
 How do you match one letter in the current locale?
 How do you print out the next line from a filehandle with all its bytes reversed?
 How many ways can we express string in Perl?
 How to concatenate strings with Perl?
 How to dereference a reference?
 How to open and read data files with Perl
 How to read file into hash array ?
 How to read from a pipeline with Perl
 How to turn on Perl warnings? Why is that important?
 If EXPR is an arbitrary expression, what is the difference between $Foo::{EXPR}
and *{"Foo::".EXPR}?
 Perl uses single or double quotes to surround a zero or more characters. Are the
single(' ') or double quotes (" ") identical?
 What are scalar data and scalar variables?
 What does Perl do if you try to exploit the execve(2) race involving setuid scripts?
 What does `$result = f() .. g()' really return?
 What does `new $cur->{LINK}' do? (Assume the current package has no new()
function of its own.)
 What does length(%HASH) produce if you have thirty-seven random keys in a newly
created hash?
 What does read() return at end of file?
 What happens to objects lost in "unreachable" memory..... ?
 What happens when you return a reference to a private variable?
 What is the easiest way to download the contents of a URL with Perl?
 What value is returned by a lone `return;' statement?
 What's the difference between /^Foo/s and /^Foo/?
 When would `local $_' in a function ruin your day?
 Which of these is a difference between C++ and Perl?
 Why aren't Perl's patterns regular expressions?
 Why do you use Perl?
 Why does Perl not have overloaded functions?
 Why is it hard to call this function: sub y { "because" }
 Why should I use the -w argument with my Perl programs?

---Object Oriented Perl, Perl Script, Perl Wild Card, Perl Asp Net, Perl Command Line

 In shell scripting How to indentify that the previous command was run successfully?
 How will you write a shell script to connect to SQL database?
 What does UID and GID signify?
 What are the different security mechanisms available in UNIX?

 What are the different types of shells available in UNIX?


 how many users have logged in and logged out in last five or 10 minutes
 How do you search the string for vowel's occurrence and number of occurrences of
each vowel
 What is make used for? How is it different from a shell script?
 How to compare floating point number in shell scripting ?
 How to delete a word from a file using shell scripting???
 How to extract the second row of a text-file?
 How to compare two floating point numbers ?
 How to compress files by using shell scripting
 What are the steps to take files from unix server to windows?
 How to find see the file which is created today,s date with time after 10 a.m to 5 p.m?
 What is the basic difference u find between a shell script and perl.I mean the
advantages of one over

 What is use of "cut" command ?Give some examples. Can we use "awk" or "sed"
 How Connect to a Database in Shell Programming?Please tell me Step by Step?
 What is this line in the shell script do #!/bin/ksh?
 Write a shell script to identify the given string is palindrome or not?
 What is the difference between writing code in shell and editor?
 What is INODE?
 What is the difference between a 'thread' and a 'process'?
 What does $# stand for?
 What is $*?
 If you have a string "one two three", Which shell command would you use to extract
the strings?
 What is the difference between a shell variable that is exported and the one that is not
exported?
 How will you list only the empty lines in a file (using grep)?
 How do you schedule a command to run at 4:00 every morning?
 How do u open a read only file in Unix?
 What are the different kinds of loops available in shell script?

---Unix Bourne Shell, Unix Shell Oracle, Unix Shell Tutorials, Sql Unix Shell, Unix
Shell Echo

Perl Interview Questions


1) What are the two different types of data perl handles?
Perl handles two types of data they are
(i) Scalar Variables and
(ii) Lists
Scalar variables hold a single data item whereas lists hold multiple data items.

2) What are scalar variables?


Scalar variables are what many programming languages refer to as simple variables.
They hold a single data item, a number, a string, or a perl reference. Scalars are called
scalars to differentiate them from constructs that can hold more than one item, like arrays.

3) Explain about lists?


A list is a construct that associates data elements together and you can specify a list by
enclosing those elements in parenthesis and separating them with commas. They could
themselves be arrays, hashes or even other lists. Lists do not have a specific list data type.

4) Name all the prefix dereferencer in perl?


The symbol that starts all scalar variables is called a prefix dereferencer. The different
types of dereferencer are.
(i) $-Scalar variables
(ii) %-Hash variables
(iii) @-arrays
(iv) &-subroutines
(v) Type globs-*myvar stands for @myvar, %myvar.
5) Explain about an ivalue?
An ivalue is an item that can serve as the target of an assignment. The term I value
originally meant a “left value”, which is to say a value that appears on the left. An ivalue
usually represents a data space in memory and you can store data using the ivalues name.
Any variable can serve as an ivalue.
6) How does a “grep” function perform?
Grep returns the number of lines the expression is true. Grep returns a sublist of a list for
which a specific criterion is true. This function often involves pattern matching. It
modifies the elements in the original list.
7) Explain about Typeglobs?
Type globs are another integral type in perl. A typeglob`s prefix derefrencer is *, which is
also the wild card character because you can use typeglobs to create an alias for all types
associated with a particular name. All kinds of manipulations are possible with typeglobs.
8) Is there any way to add two arrays together?
Of course you can add two arrays together by using push function. The push function
adds a value or values to the end of an array. The push function pushes the values of list
onto the end of the array. Length of an array can be increased by the length of list.
9) How to use the command shift?
Shift array function shifts off the first value of the array and returns it, thereby shortening
the array by one element and moving everything from one place to the left. If you don’t
specify an array to shift, shift uses @ ARGV, the array of command line arguments
passed to the script or the array named @-.
10) What exactly is grooving and shortening of the array?
You can change the number of elements in an array simply by changing the value of the
last index of/in the array $#array. In fact, if you simply refer to a non existent element in
an array perl extends the array as needed, creating new elements. It also includes new
elements in its array.
11) What are the three ways to empty an array?
The three different ways to empty an array are as follows
1) You can empty an array by setting its length to a negative number.
2) Another way of empting an array is to assign the null list ().
3) Try to clear an array by setting it to undef, but be aware when you set to undef.

12) How do you work with array slices


An array slice is a section of an array that acts like a list, and you indicate what elements
to put into the slice by using multiple array indexes in square brackets. By specifying the
range operator you can also specify a slice.
13) What is meant by splicing arrays explain in context of list and scalar.
Splicing an array means adding elements from a list to that array, possibly replacing
elements now in the array. In list context, the splice function returns the elements
removed from the array. In scalar context, the splice function returns the last element
removed.
14) What are the different types of perl operators?
There are four different types of perl operators they are
(i) Unary operator like the not operator
(ii) Binary operator like the addition operator
(iii) Tertiary operator like the conditional operator
(iv) List operator like the print operator
15) Which has the highest precedence, List or Terms? Explain?
Terms have the highest precedence in perl. Terms include variables, quotes, expressions
in parenthesis etc. List operators have the same level of precedence as terms. Specifically,
these operators have very strong left word precedence.
16) What is a short circuit operator?
The C-Style operator, ll, performs a logical (or) operation and you can use it to tie logical
clauses together, returning an overall value of true if either clause is true. This operator is
called a short-circuit operator because if the left operand is true the right operand is not
checked or evaluated.

17) What are the different forms of goto in perl? Explain?


The three forms of goto are as follows. They are
(i) Goto label
(ii) Goto name
(iii) Goto expr
The first form, goto LABEL, transfers execution to the statement labeled LABEL. The
second form, goto EXPR, expects EXPR to evaluate to a label. The last form goto &name
is used with subroutines. This goto statement is used only when there is a necessity as it
can create havoc in a program.
18) What are the different types of eval statements?
There are two different types of eval statements they are eval EXPR and eval BLOCK.
Eval EXPR executes an expression and eval BLOCK executes BLOCK. Eval Block
executes an entire block, BLOCK. First one is used when you want your code passed in
the expression and the second one is used to parse the code in the block.
19) Determine the difference between my and local?
The fundamental difference between my and local is that my creates a new variable,
whereas local saves a copy of an existing variable.
20) Explain about returning values from subroutines (functions)?
The return value of the subroutine is the value of the last expression evaluated or you can
explicitly use a return statement to exit the subroutine specifying the return value. That
return value is evaluated in the appropriate content depending on the content of the
subroutine call.
Perl Interview Questions and Answers
Why do you use Perl?
Perl is a powerful free interpreter.
Perl is portable, flexible and easy to learn.

How do I set environment variables in Perl programs?


you can just do something like this:
$path = $ENV{'PATH'};
As you may remember, "%ENV" is a special hash in Perl that contains the value of all
your environment variables.
Because %ENV is a hash, you can set environment variables just as you'd set the value of
any Perl hash variable. Here's how you can set your PATH variable to make sure the
following four directories are in your path::
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin:/home/yourname/bin';

Which of these is a difference between C++ and Perl?


Perl can have objects whose data cannot be accessed outside its class, but C++ cannot.
Perl can use closures with unreachable private data as objects, and C++ doesn't support
closures. Furthermore, C++ does support pointer arithmetic via `int *ip = (int*)&object',
allowing you do look all over the object. Perl doesn't have pointer arithmetic. It also
doesn't allow `#define private public' to change access rights to foreign objects. On the
other hand, once you start poking around in /dev/mem, no one is safe.

How to open and read data files with Perl


Data files are opened in Perl using the open() function. When you open a data file, all you
have to do is specify (a) a file handle and (b) the name of the file you want to read from.
As an example, suppose you need to read some data from a file named "checkbook.txt".
Here's a simple open statement that opens the checkbook file for read access: open
(CHECKBOOK, "checkbook.txt"); In this example, the name "CHECKBOOK" is the file
handle that you'll use later when reading from the checkbook.txt data file. Any time you
want to read data from the checkbook file, just use the file handle named
"CHECKBOOK".
Now that we've opened the checkbook file, we'd like to be able to read what's in it. Here's
how to read one line of data from the checkbook file:
$record = < CHECKBOOK > ;
After this statement is executed, the variable $record contains the contents of the first line
of the checkbook file. The "<>" symbol is called the line reading operator.
To print every record of information from the checkbook file

open (CHECKBOOK, "checkbook.txt") || die "couldn't open the file!";


while ($record = < CHECKBOOK >) {
print $record;
}
close(CHECKBOOK);

How do I do fill_in_the_blank for each file in a directory?


Here's code that just prints a listing of every file in the current directory:
#!/usr/bin/perl -w
opendir(DIR, ".");
@files = readdir(DIR);
closedir(DIR);
foreach $file (@files) {
print "$file\n";
}

How do I do fill_in_the_blank for each file in a directory?

Here's code that just prints a listing of every file in the current directory:
#!/usr/bin/perl -w
opendir(DIR, ".");
@files = readdir(DIR);
closedir(DIR);
foreach $file (@files) {
print "$file\n";
}

How do I generate a list of all .html files in a directory?


Here's a snippet of code that just prints a listing of every file in the current directory that
ends with the extension .html:
#!/usr/bin/perl -w
opendir(DIR, ".");
@files = grep(/\.html$/,readdir(DIR));
closedir(DIR);
foreach $file (@files) {
print "$file\n";
}

What is Perl one-liner?


There are two ways a Perl script can be run:
--from a command line, called one-liner, that means you type and execute immediately
on the command line. You'll need the -e option to start like "C:\ %gt perl -e
"print \"Hello\";". One-liner doesn't mean one Perl statement. One-liner may contain
many statements in one line.
--from a script file, called Perl program.
Assuming both a local($var) and a my($var) exist, what's the difference between $
{var} and ${"var"}?
${var} is the lexical variable $var, and ${"var"} is the dynamic variable $var.
Note that because the second is a symbol table lookup, it is disallowed under `use strict
"refs"'. The words global, local, package, symbol table, and dynamic all refer to the kind
of variables that local() affects, whereas the other sort, those governed by my(), are
variously knows as private, lexical, or scoped variable.

What happens when you return a reference to a private variable?


Perl keeps track of your variables, whether dynamic or otherwise, and doesn't free things
before you're done using them.

How to turn on Perl warnings? Why is that important?


Perl is very forgiving of strange and sometimes wrong code, which can mean hours spent
searching for bugs and weird results. Turning on warnings helps uncover common
mistakes and strange places and save a lot of debugging time in the long run. There are
various ways of turning on Perl warnings:
For Perl one-liner, use -w option on the command line.
On Unix or Windows, use the -w option in the shebang line (The first # line in the script).
Note: Windows Perl interpreter may not require it.
For other systems, choose compiler warnings, or check compiler documentation.

What are scalar data and scalar variables?


Perl has a flexible concept of data types. Scalar means a single thing, like a number or
string. So the Java concept of int, float, double and string equals to Perl\'s scalar in
concept and the numbers and strings are exchangeable. Scalar variable is a Perl variable
that is used to store scalar data. It uses a dollar sign $ and followed by one or more
alphanumeric characters or underscores. It is case sensitive.

Perl Interview Questions and Answers


Why should I use the -w argument with my Perl programs?
Many Perl developers use the -w option of the interpreter, especially during the
development stages of an application. This warning option turns on many warning
messages that can help you understand and debug your applications.
To use this option on Unix systems, just include it on the first line of the program, like
this:
#!/usr/bin/perl -w
If you develop Perl apps on a DOS/Windows computer, and you're creating a program
named myApp.pl, you can turn on the warning messages when you run your program like
this:
perl -w myApp.pl
Assuming $_ contains HTML, which of the following substitutions will remove all
tags in it?
1.s/<.*>//g;
2.s/<.*?>//gs;
3.s/<\/?[A-Z]\w*(?:\s+[A-Z]\w*(?:\s*=\s*(?:(["']).*?\1|[\w-.]+))?)*\s*>//gsix;

You can't do that.


If it weren't for HTML comments, improperly formatted HTML, and tags with interesting
data like < SCRIPT >, you could do this. Alas, you cannot. It takes a lot more smarts, and
quite frankly, a real parser.

I want users send data by formmail but when they send nothing or call it from web
site they will see error.
codes in PHP like this:
if (isset($HTTP_POST_VARS)){
..........
}
else{
echo ("error lalalalal")
}
How it will look in perl?

In php it will be like


if (isset($HTTP_POST_VARS)){
....
}
In perl, tried this.
if ($ENV{'REQUEST_METHOD'} eq 'POST'){
.....
}

What is the output of the following Perl program?


1 $p1 = "prog1.java";
2 $p1 =~ s/(.*)\.java/$1.cpp/;
3 print "$p1\n";

prog1.cpp

Why aren't Perl's patterns regular expressions?

Because Perl patterns have backreferences.


A regular expression by definition must be able to determine the next state in the finite
automaton without requiring any extra memory to keep around previous state. A pattern /
([ab]+)c\1/ requires the state machine to remember old states, and thus disqualifies such
patterns as being regular expressions in the classic sense of the term.

What does Perl do if you try to exploit the execve(2) race involving setuid scripts?
Sends mail to root and exits.
It has been said that all programs advance to the point of being able to automatically read
mail. While not quite at that point (well, without having a module loaded), Perl does at
least automatically send it.

How do I do < fill-in-the-blank > for each element in a hash?


Here's a simple technique to process each element in a hash:

#!/usr/bin/perl -w

%days = (
'Sun' =>'Sunday',
'Mon' => 'Monday',
'Tue' => 'Tuesday',
'Wed' => 'Wednesday',
'Thu' => 'Thursday',
'Fri' => 'Friday',
'Sat' => 'Saturday' );

foreach $key (sort keys %days) {


print "The long name for $key is $days{$key}.\n";
}

How do I sort a hash by the hash key?


Suppose we have a class of five students.
Their names are kim, al, rocky, chrisy, and jane.

Here's a test program that prints the contents


of the grades hash, sorted by student name:

#!/usr/bin/perl -w

%grades = (
kim => 96,
al => 63,
rocky => 87,
chrisy => 96,
jane => 79,
);

print "\n\tGRADES SORTED BY STUDENT NAME:\n";


foreach $key (sort (keys(%grades))) {
print "\t\t$key \t\t$grades{$key}\n";
}

The output of this program looks like this:

GRADES SORTED BY STUDENT NAME:


al 63
chrisy 96
jane 79
kim 96
rocky 87

How do you print out the next line from a filehandle with all its bytes reversed?
print scalar reverse scalar <FH>
Surprisingly enough, you have to put both the reverse and the <FH> into scalar context
separately for this to work.

How do I send e-mail from a Perl/CGI program on a Unix system?


Sending e-mail from a Perl/CGI program on a Unix computer system is usually pretty
simple. Most Perl programs directly invoke the Unix sendmail program. We'll go through
a quick example here.
Assuming that you've already have e-mail information you need, such as the send-to
address and subject, you can use these next steps to generate and send the e-mail
message:
# the rest of your program is up here ...
open(MAIL, "|/usr/lib/sendmail -t");
print MAIL "To: $sendToAddress\n";
print MAIL "From: $myEmailAddress\n";
print MAIL "Subject: $subject\n";
print MAIL "This is the message body.\n";
print MAIL "Put your message here in the body.\n";
close (MAIL);

How to read from a pipeline with Perl


Example 1:

To run the date command from a Perl program, and read the output
of the command, all you need are a few lines of code like this:

open(DATE, "date|");
$theDate = <DATE>;
close(DATE);

The open() function runs the external date command, then opens
a file handle DATE to the output of the date command.

Next, the output of the date command is read into


the variable $theDate through the file handle DATE.

Example 2:

The following code runs the "ps -f" command, and reads the output:

open(PS_F, "ps -f|");


while (<PS_F>) {
($uid,$pid,$ppid,$restOfLine) = split;
# do whatever I want with the variables here ...
}
close(PS_F);

Why is it hard to call this function: sub y { "because" }


Because y is a kind of quoting operator.
The y/// operator is the sed-savvy synonym for tr///. That means y(3) would be like tr(),
which would be looking for a second string, as in tr/a-z/A-Z/, tr(a-z)(A-Z), or tr[a-z][A-
Z].

What does `$result = f() .. g()' really return?


False so long as f() returns false, after which it returns true until g() returns true, and then
starts the cycle again.
This is scalar not list context, so we have the bistable flip-flop range operator famous in
parsing of mail messages, as in `$in_body = /^$/ .. eof()'. Except for the first time f()
returns true, g() is entirely ignored, and f() will be ignored while g() later when g() is
evaluated. Double dot is the inclusive range operator, f() and g() will both be evaluated
on the same record. If you don't want that to happen, the exclusive range operator, triple
dots, can be used instead. For extra credit, describe this:
$bingo = ( a() .. b() ) ... ( c() .. d() );

Why does Perl not have overloaded functions?


Because you can inspect the argument count, return context, and object types all by
yourself.
In Perl, the number of arguments is trivially available to a function via the scalar sense of
@_, the return context via wantarray(), and the types of the arguments via ref() if they're
references and simple pattern matching like /^\d+$/ otherwise. In languages like C++
where you can't do this, you simply must resort to overloading of functions.
What does read() return at end of file?
0
A defined (but false) 0 value is the proper indication of the end of file for read() and
sysread().

What does `new $cur->{LINK}' do? (Assume the current package has no new()
function of its own.)
$cur->new()->{LINK}
The indirect object syntax only has a single token lookahead. That means if new() is a
method, it only grabs the very next token, not the entire following expression.
This is why `new $obj[23] arg' does't work, as well as why `print $fh[23] "stuff\n"' does't
work. Mixing notations between the OO and IO notations is perilous. If you always use
arrow syntax for method calls, and nothing else, you'll not be surprised.

How do I sort a hash by the hash value?


Here's a program that prints the contents
of the grades hash, sorted numerically by the hash value:

#!/usr/bin/perl -w

# Help sort a hash by the hash 'value', not the 'key'.


to highest).
sub hashValueAscendingNum {
$grades{$a} <=> $grades{$b};
}

# Help sort a hash by the hash 'value', not the 'key'.


# Values are returned in descending numeric order
# (highest to lowest).
sub hashValueDescendingNum {
$grades{$b} <=> $grades{$a};
}

%grades = (
student1 => 90,
student2 => 75,
student3 => 96,
student4 => 55,
student5 => 76,
);

print "\n\tGRADES IN ASCENDING NUMERIC ORDER:\n";


foreach $key (sort hashValueAscendingNum (keys(%grades))) {
print "\t\t$grades{$key} \t\t $key\n";
}

print "\n\tGRADES IN DESCENDING NUMERIC ORDER:\n";


foreach $key (sort hashValueDescendingNum (keys(%grades))) {
print "\t\t$grades{$key} \t\t $key\n";
}

How to read file into hash array ?


open(IN, "<name_file")
or die "Couldn't open file for processing: $!";
while (<IN>) {
chomp;
$hash_table{$_} = 0;
}
close IN;

print "$_ = $hash_table{$_}\n" foreach keys %hash_table;

How do you find the length of an array?


$@array

What value is returned by a lone `return;' statement?


The undefined value in scalar context, and the empty list value () in list context.
This way functions that wish to return failure can just use a simple return without
worrying about the context in which they were called.

What's the difference between /^Foo/s and /^Foo/?


The second would match Foo other than at the start of the record if $* were set.
The deprecated $* flag does double duty, filling the roles of both /s and /m. By using /s,
you suppress any settings of that spooky variable, and force your carets and dollars to
match only at the ends of the string and not at ends of line as well -- just as they would if
$* weren't set at all.

Does Perl have reference type?


Yes. Perl can make a scalar or hash type reference by using backslash operator.
For example
$str = "here we go"; # a scalar variable
$strref = \$str; # a reference to a scalar

@array = (1..10); # an array


$arrayref = \@array; # a reference to an array
Note that the reference itself is a scalar.
How to dereference a reference?
There are a number of ways to dereference a reference.
Using two dollar signs to dereference a scalar.
$original = $$strref;
Using @ sign to dereference an array.
@list = @$arrayref;
Similar for hashes.

What does length(%HASH) produce if you have thirty-seven random keys in a


newly created hash?
5
length() is a built-in prototyped as sub length($), and a scalar prototype silently changes
aggregates into radically different forms. The scalar sense of a hash is false (0) if it's
empty, otherwise it's a string representing the fullness of the buckets, like "18/32" or
"39/64". The length of that string is likely to be 5. Likewise, `length(@a)' would be 2 if
there were 37 elements in @a.

If EXPR is an arbitrary expression, what is the difference between $Foo::{EXPR}


and *{"Foo::".EXPR}?
The second is disallowed under `use strict "refs"'.
Dereferencing a string with *{"STR"} is disallowed under the refs stricture, although
*{STR} would not be. This is similar in spirit to the way ${"STR"} is always the symbol
table variable, while ${STR} may be the lexical variable. If it's not a bareword, you're
playing with the symbol table in a particular dynamic fashion.

How do I do < fill-in-the-blank > for each element in an array?


#!/usr/bin/perl -w
@homeRunHitters = ('McGwire', 'Sosa', 'Maris', 'Ruth');
foreach (@homeRunHitters) {
print "$_ hit a lot of home runs in one year\n";
}

How do I replace every <TAB> character in a file with a comma?

perl -pi.bak -e 's/\t/,/g' myfile.txt

What is the easiest way to download the contents of a URL with Perl?

Once you have the libwww-perl library, LWP.pm installed, the code is this:
#!/usr/bin/perl
use LWP::Simple;
$url = get 'http://www.websitename.com/';

How to concatenate strings with Perl?

Method #1 - using Perl's dot operator:


$name = 'checkbook';
$filename = "/tmp/" . $name . ".tmp";

Method #2 - using Perl's join function


$name = "checkbook";
$filename = join "", "/tmp/", $name, ".tmp";

Method #3 - usual way of concatenating strings


$filename = "/tmp/${name}.tmp";

How do I read command-line arguments with Perl?

With Perl, command-line arguments are stored in the array named @ARGV.
$ARGV[0] contains the first argument, $ARGV[1] contains the second argument, etc.
$#ARGV is the subscript of the last element of the @ARGV array, so the number of
arguments on the command line is $#ARGV + 1.
Here's a simple program:
#!/usr/bin/perl
$numArgs = $#ARGV + 1;
print "thanks, you gave me $numArgs command-line arguments.\n";
foreach $argnum (0 .. $#ARGV) {
print "$ARGV[$argnum]\n";
}

When would `local $_' in a function ruin your day?


When your caller was in the middle for a while(m//g) loop
The /g state on a global variable is not protected by running local on it. That'll teach you
to stop using locals. Too bad $_ can't be the target of a my() -- yet.

What happens to objects lost in "unreachable" memory, such as the object returned
by Ob->new() in `{ my $ap; $ap = [ Ob->new(), \$ap ]; }' ?
Their destructors are called when that interpreter thread shuts down.
When the interpreter exits, it first does an exhaustive search looking for anything that it
allocated. This allows Perl to be used in embedded and multithreaded applications safely,
and furthermore guarantees correctness of object code.

Assume that $ref refers to a scalar, an array, a hash or to some nested data
structure. Explain the following statements:
$$ref; # returns a scalar
$$ref[0]; # returns the first element of that array
$ref- > [0]; # returns the first element of that array
@$ref; # returns the contents of that array, or number of elements, in scalar context
$&$ref; # returns the last index in that array
$ref- > [0][5]; # returns the sixth element in the first row
@{$ref- > {key}} # returns the contents of the array that is the value of the key "key"

How do you match one letter in the current locale?


/[^\W_\d]/
We don't have full POSIX regexps, so you can't get at the isalpha() <ctype.h> macro save
indirectly. You ask for one byte which is neither a non-alphanumunder, nor an under, nor
a numeric. That leaves just the alphas, which is what you want.

How do I print the entire contents of an array with Perl?


To answer this question, we first need a sample array. Let's assume that you have an array
that contains the name of baseball teams, like this:
@teams = ('cubs', 'reds', 'yankees', 'dodgers');
If you just want to print the array with the array members separated by blank spaces, you
can just print the array like this:
@teams = ('cubs', 'reds', 'yankees', 'dodgers');
print "@teams\n";
But that's not usually the case. More often, you want each element printed on a separate
line. To achieve this, you can use this code:
@teams = ('cubs', 'reds', 'yankees', 'dodgers');
foreach (@teams) {
print "$_\n";
}

Perl uses single or double quotes to surround a zero or more characters. Are the
single(' ') or double quotes (" ") identical?
They are not identical. There are several differences between using single quotes and
double quotes for strings.
1. The double-quoted string will perform variable interpolation on its contents. That is,
any variable references inside the quotes will be replaced by the actual values.
2. The single-quoted string will print just like it is. It doesn't care the dollar signs.
3. The double-quoted string can contain the escape characters like newline, tab, carraige
return, etc.
4. The single-quoted string can contain the escape sequences, like single quote, backward
slash, etc.

How many ways can we express string in Perl?


Many. For example 'this is a string' can be expressed in:
"this is a string"
qq/this is a string like double-quoted string/
qq^this is a string like double-quoted string^
q/this is a string/
q&this is a string&
q(this is a string)
How do you give functions private variables that retain their values between calls?
Create a scope surrounding that sub that contains lexicals.
Only lexical variables are truly private, and they will persist even when their block exits
if something still cares about them. Thus:
{ my $i = 0; sub next_i { $i++ } sub last_i { --$i } }
creates two functions that share a private variable. The $i variable will not be deallocated
when its block goes away because next_i and last_i need to be able to access it.

1. What arguments do you frequently use for the Perl interpreter and what do they
mean?
2. What does the command ‘use strict’ do and why should you use it?
3. What do the symbols $ @ and % mean when prefixing a variable?
4. What elements of the Perl language could you use to structure your code to allow
for maximum re-use and maximum readability?
5. What are the characteristics of a project that is well suited to Perl?
6. Why do you program in Perl?
7. Explain the difference between my and local.
8. Explain the difference between use and require.
9. What’s your favorite module and why?
10. What is a hash?
11. Write a simple (common) regular expression to match an IP address, e-mail
address, city-state-zipcode combination.
12. What purpose does each of the following serve: -w, strict, -T ?
13. What is the difference between for & foreach, exec & system?
14. Where do you go for Perl help?
15. Name an instance where you used a CPAN module.
16. How do you open a file for writing?
17. How would you replace a char in string and how do you store the number of
replacements?
18. When would you not use Perl for a project?

# Write a simple (common) regular expression to match an IP address, e-mail address,


city-state-zipcode combination.

This is a bad idea. An e-mail address is much harder than /^[\w\.]+\@\[\w\.]+\.[com|net|


org]$/ - Check out RFC822 for more info. Same thing with city-state-zip. Rural addresses
will blow you out of the water.

Much better is something like:


# Write a regular expression to match a phone number.

Then, you watch how they write it. Of course, the regex is going to differ depending on
what country you’re in. Important is whether or not they provide capturing, varying input
lengths, and how they handle invalid input.

local and my are different

local does not work the same way as my. In particular, it doesn’t create private variables.
Variables declared local remain global. Instead, Perl assigns a temporary value to the
variable, and then restores the old value when the variable goes out of scope.

Because variables declared as local are still global variables, there is another time where
they are handy. Remember that my variables are private, and cannot be seen by
subroutines. This is not true when they are declared local.

Perl offers several different ways to include code from one file into another. Here are the
differences between the various inclusion commands:

1) do $file is like eval `cat $file`, except that do


1.1: searches @INC and updates %INC.
1.2: gives an *unrelated* lexical scope to the eval’ed code.
2) require $file is like do $file, except that require
2.1: checks for redundant loading, skipping already loaded files.
2.2: raises an exception on failure to find, compile, or execute $file.
2.3: It may help, if you’re a C programmer, to think of require
as being like #include
3) require Module is like require “Module.pm”, except that require
3.1: translates each “::” into your system’s directory separator.
3.2: primes the parser to disambiguate class Module as an
indirect object.
4) use Module is like require Module, except that use
4.1: loads the module at compile time, not run-time.
4.2: imports symbols and semantics from that package to the current one
When would you not use Perl for a project?

When your manager forbids it–but do consider replacing them :-).

Actually, one good reason is when you already have an existing application written in
another language that’s all done (and done well), or you have an application language
specifically designed for a certain task (e.g. prolog, make).

For various reasons, Perl is probably not well-suited for real-time embedded systems,
low-level operating systems development work like device drivers or context-switching
code, complex multi-threaded shared-memory applications, or extremely large
applications. You’ll notice that perl is not itself written in Perl.

The new, native-code compiler for Perl may eventually reduce the limitations given in the
previous statement to some degree, but understand that Perl remains fundamentally a
dynamically typed language, not a statically typed one. You certainly won’t be chastised
if you don’t trust nuclear-plant or brain-surgery monitoring code to it. And Larry will
sleep easier, too–Wall Street programs not withstanding. :-)

Regular Expression of IP Address :

(\d|\d\d|1\d\d|2[0-4]\d|25[0-5]).

:-)

Answer 3:
These are the variables begin with “$”, “@” or “%” in Perl

I want to ask question that what is the differance while using package in JAVA and in
PERL and also what do we mean by %main:: and %:: are same??

hope you give me that answers very soon


 What arguments do you frequently use for the Perl interpreter and what do they
mean?
perl [ -sTuU ] [ -hv ] [ -V[:configvar] ] [ -cw ] [ -d[:debugger] ] [ -D[number/list] ] [
-pna ] [ -Fpattern ] [ -l[octal] ] [ -0[octal] ] [ -Idir ] [ -m[-]module ] [ -M[-]‘module…’ ] [
-P ] [ -S ] [ -x[dir] ] [ -i[extension] ] [ -e 'command' ] [ -- ] [ programfile ] [ argument ]
What does the command ‘use strict’ do and why should you use it?
A command like use strict is called a pragma. Pragmas are instructions to the Perl
interpreter to do something special when it runs your program. use strict does two things
that make it harder to write bad software: It makes you declare all your variables (“strict
vars”), and it makes it harder for Perl to mistake your intentions when you are using subs
(“strict subs”).
What do the symbols $ @ and % mean when prefixing a variable?
$varialble
@array
%hash
What elements of the Perl language could you use to structure your code to allow for
maximum re-use and maximum readability?
modules
What are the characteristics of a project that is well suited to Perl?
For writing exploits, testing products and apps, identifying new Web-based
vulnerabilities, and creating complex regular-expression engines.
Why do you program in Perl? Why not
Explain the difference between my and local.
The variables declared with my() are visible only within the scope of the block which
names them. They are not visible outside of this block, not even in routines or blocks that
it calls. local() variables, on the other hand, are visible to routines that are called from the
block where they are declared. Neither is visible after the end (the final closing curly
brace) of the block at all.
Explain the difference between use and require.
require() reads a file containing Perl code and compiles it. Before attempting to load the
file it looks up the argument in %INC to see whether it has already been loaded. If it has,
require() just returns without doing a thing. Otherwise an attempt will be made to load
and compile the file.
require() has to find the file it has to load. If the argument is a full path to the file, it just
tries to read it. For example:
require “/home/httpd/perl/mylibs.pl”;
If the path is relative, require() will attempt to search for the file in all the directories
listed in @INC. For example:
require “mylibs.pl”;
If there is more than one occurrence of the file with the same name in the directories
listed in @INC the first occurrence will be used.
The file must return TRUE as the last statement to indicate successful execution of any
initialization code. Since you never know what changes the file will go through in the
future, you cannot be sure that the last statement will always return TRUE. That’s why
the suggestion is to put “1;” at the end of file.
Although you should use the real filename for most files, if the file is a module, you may
use the following convention instead:
require My::Module;
This is equal to:
require “My/Module.pm”;
If require() fails to load the file, either because it couldn’t find the file in question or the
code failed to compile, or it didn’t return TRUE, then the program would die(). To
prevent this the require() statement can be enclosed into an eval() exception-handling
block, as in this example:
require.pl
———-
#!/usr/bin/perl -w

eval { require “/file/that/does/not/exists”};


if ($@) {
print “Failed to load, because : $@”
}
print “\nHello\n”;
When we execute the program:
% ./require.pl

Failed to load, because : Can’t locate /file/that/does/not/exists in


@INC (@INC contains: /usr/lib/perl5/5.00503/i386-linux
/usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linux
/usr/lib/perl5/site_perl/5.005 .) at require.pl line 3.

Hello
We see that the program didn’t die(), because Hello was printed. This trick is useful when
you want to check whether a user has some module installed, but if she hasn’t it’s not
critical, perhaps the program can run without this module with reduced functionality.
If we remove the eval() part and try again:
require.pl
———-
#!/usr/bin/perl -w

require “/file/that/does/not/exists”;
print “\nHello\n”;
% ./require1.pl

Can’t locate /file/that/does/not/exists in @INC (@INC contains:


/usr/lib/perl5/5.00503/i386-linux /usr/lib/perl5/5.00503
/usr/lib/perl5/site_perl/5.005/i386-linux
/usr/lib/perl5/site_perl/5.005 .) at require1.pl line 3.
The program just die()s in the last example, which is what you want in most cases.
use(), just like require(), loads and compiles files containing Perl code, but it works with
modules only and is executed at compile time.
The only way to pass a module to load is by its module name and not its filename. If the
module is located in MyCode.pm, the correct way to use() it is:
use MyCode
and not:
use “MyCode.pm”
use() translates the passed argument into a file name replacing :: with the operating
system’s path separator (normally /) and appending .pm at the end. So My::Module
becomes My/Module.pm.
use() is exactly equivalent to:
BEGIN { require Module; Module->import(LIST); }
Internally it calls require() to do the loading and compilation chores. When require()
finishes its job, import() is called unless () is the second argument. The following pairs
are equivalent:
use MyModule;
BEGIN {require MyModule; MyModule->import; }

use MyModule qw(foo bar);


BEGIN {require MyModule; MyModule->import(”foo”,”bar”); }

use MyModule ();


BEGIN {require MyModule; }
The first pair exports the default tags. This happens if the module sets @EXPORT to a
list of tags to be exported by default. The module’s manpage normally describes what
tags are exported by default.
The second pair exports only the tags passed as arguments.
The third pair describes the case where the caller does not want any symbols to be
imported.
import() is not a builtin function, it’s just an ordinary static method call into the
“MyModule” package to tell the module to import the list of features back into the
current package. See the Exporter manpage for more information.
When you write your own modules, always remember that it’s better to use
@EXPORT_OK instead of @EXPORT, since the former doesn’t export symbols unless
it was asked to. Exports pollute the namespace of the module user. Also avoid short or
common symbol names to reduce the risk of name clashes.
When functions and variables aren’t exported you can still access them using their full
names, like $My::Module::bar or $My::Module::foo(). By convention you can use a
leading underscore on names to informally indicate that they are internal and not for
public use.
There’s a corresponding “no” command that un-imports symbols imported by use, i.e., it
calls Module->unimport(LIST) instead of import().
What’s your favorite module and why? IO::Socket
Where do you go for Perl help?Google. CPAN.
When would you not use Perl for a project? For longer term projects

 Balaji
Posted 5/15/2007 at 5:07 am | Permalink

3. What do the symbols $ @ and % mean when prefixing a variable?

Answer:
$ is used for a normal variable.
@ is for an index array.
% is for associative array.

 novandria
Posted 6/12/2007 at 3:50 pm | Permalink

What do the symbols $ @ and % mean when prefixing a variable?

$ Scalar
@ Array
% Hash

 Shail
Posted 6/22/2007 at 5:51 am | Permalink

Q -> How do you open a file for writing?

open (”FH”, “>filename.dat”) || die “Can’t create the file\n”;

Later use FH to perform all file realted operation.

Cheers!
Shail
 Shail
Posted 6/22/2007 at 5:58 am | Permalink

Q -> What does the command ‘use strict’ do and why should you use
it?

As we know that in PERL there is no need to define the variable prior to use. Sometime
while dealing with a bulky code spelling mistake can cause a big trouble. For example

——————-

#!/usr/bin/perl

$input = 5;
print $ipnut,”\n”;

——————-

this code will get executed without any error but the result would be something other than
5.

To avoid such issues we genraly use:

——————-

#/usr/bin/perl

use strict;

my $input =5;
print $ipnut,”\n”;

——————-

This would throw an error at the time of execution. As ‘$ipnut’ is not defined anywhere
in the code.

Cheers!
Shail
 Steve Coleman
Posted 7/7/2007 at 8:08 am | Permalink

I’m running a PERL script on Linux ES 4 with ActiveState 5.8.8.820 (just upgraded). I
have a perl script that builds command line functions for Oracle Application Server
DMSTOOL commands. Basically from info provide I construct the DMSTOOL
command, execute it, and parse the output. Everything works fine on Windows but when
I ported the script to Linux, it ceased to function. I converted everthing that needed to be
converted. The only thing left is a string concatenation that won’t concatenate properly.
I’m attempting to build a command, $dmscommand, by concatenating ‘dmstool -table’ .
tablename . ‘ -count 1′….when perl executes this…it takes the ‘ -count 1 and places it as
the begining of $dmscommand overlaying the ‘dmstool -table tablename’ portion….I
tried JOIN..same thing…what is it about ‘ -count 1′?????? Any guidance would be most
apprecidate.

 Mahesh R
Posted 10/25/2007 at 1:15 pm | Permalink

Where do you go for Perl help?

PerlDoc is a very good documentation for perl. Apart from perl doc you can check in
“search.cpan.org” website for the specific modules details which you are using.
There are some good books from Orielly as well.

 Simple
Posted 10/25/2007 at 1:18 pm | Permalink

Name an instance where you used a CPAN module?

a. XMLParser: Parsing XML files.

 mayavi
Posted 7/30/2008 at 12:37 pm | Permalink

Q3. What do the symbols $ @ and % mean when prefixing a variable?

$ -> is used to denote a scalar variable

@ -> is used to denote an variable of type array

% -> is used to denote a variable of type Hash

 mayavi
Posted 7/30/2008 at 2:29 pm | Permalink

Q-10. What is a hash?


Hash is primitive data structure in Perl as in all other languages.
A hash is a key => value pair mapping. Given a unique key you can store an associated
value for the key.

The time complexity for read, insert and deletion are O(1).

 mayavi
Posted 7/30/2008 at 2:40 pm | Permalink

Q What elements of the Perl language could you use to structure your code to allow for
maximum re-use and maximum readability?

Perl can be used as a fully Object Oriented language with Packages, Classes and
modules.

This brings more modularity to the code

1. What arguments do you frequently use for the Perl interpreter and what do they mean?

Man... I use lots of them!!! I can't explain them all :-) I even gave a talk and wrote an
award winning paper on them... But OK, I guess I'd go with -e for one-liners -n and -p for
line processing, and probably with -i for inline processing (I would mention -w, but I "use
warnings" instead)

2. What does the command ‘use strict’ do and why should you use it?

It enforces strictness! :-) You should use it because it will help you avoid pestering errors
that nobody likes (forgotten my declarations being the most usual ones). I nowadays use
it most for discipline. It's not that one my programs wouldn't work without it, but I prefer
to be on the safe side. Also note that I don't use strict for one-liners.

3. What do the symbols $ @ and % mean when prefixing a variable?

They mean what's after them is supposed to be interpreted, respectively, as a scalar, an


array or a hash.

4. What elements of the Perl language could you use to structure your code to allow for
maximum re-use and maximum readability?

Are you refering to modules or am I getting something wrong? Are you talking about
objects? Some good practices? I think the question should be rephrased...

5. What are the characteristics of a project that is well suited to Perl?

It's not the project that is well suited, it's the language that might be! And I don't feel
confortable yet (with the current experience I have) answering to that :-) Sorry :-)

Second round :-)

1. Why do you program in Perl?

Because it's fun and fast (to code). I don't spend loads of time trying to figure why the
code doesn't work when I could be spending it thinking about how to solve the problem.
The community around it is also a big plus!

2. Explain the difference between my and local.

I'm not sure but I think I heard someone say it was kind of the same thing, internally... I
may be wrong about this... But you do get the same effect, apart from some weird case
I'm not thinking about right now...

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 :-)

4. What’s your favorite module and why?


CPAN::Mini, for now I have the CPAN on my laptop and no longer rely on internet
access to install new modules. If you asked me for another one, it would be
Data::Dumper

5. What is a hash?

Look... that is not a Perl question... but OK, I'll play along... Think of it as a table with
two columns. You put keys in the left column and their corresponding values in the right
one. And then I should tell you lots of stuff, like "You can't have a value with a key",
"You can't have two values for the same key" and so on (No, you can't have two values
for the same key, what you can have is a value that holds more stuff inside it).

6. Write a simple (common) regular expression to match an IP address, e-mail address,


city-state-zipcode combination.

IP address: qr/(\d{1,3}\.){3}\d{1,3}/ # Yes, it accepts 0's at the beginning and that's


probably wrong, but then again, I'm not actually at a job interview :-)

e-mail address: qr/\w+\@\w+\.\w+/ # once again, that's wrong; I would have to check on
what's valid and what's not, because I really don't know :-)

city-state-zipcode: Being Portuguese, I really do not know what a city-state-zipcode


combination looks like :-\

7. What purpose does each of the following serve: -w, strict, -T ?

-w uses warnings, strict has already been explained above and -T is tainted mode, which I
usually don't use because I don't usually get information I don't trust.

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)

9. Where do you go for Perl help?

I usually *give* Perl help, but when I need it (because I sometimes do too) I first ask
some friends of mine, and then I come to perlmonks.

10. Name an instance where you used a CPAN module.

I use CPAN modules on a daily basis :-) I used LWP the other day to retrieve my yml
files (kwalitee stuff)

11. How do you open a file for writing?


Usually with open (FILE, ">$file") or die "could not open file '$file' for
writing ($!)";

12. How would you replace a char in string and how do you

$string =~ y/a/b/

13. store the number of replacements?

my $number = y/blah/blah/, but that's not really a good question, because many
people don't know that, and that doesn't make them worse programmers.

14. When would you not use Perl for a project?

When Hell freezes over :-P

"2. Explain the difference between my and local.


I'm not sure but I think I heard someone say it was kind of the same thing, internally... I"
There is actually a significant difference. "my" creates lexically scoped variables (e.g.
existing within a block.) "local" variables have run-time scoping; "local" saves the
(previously defined) values of arguments on a stack and later restores them, using the
"locally defined" values during some containing scope. Changes made by "local" to
global variables can be visible outside the lexical scope of the "local" variables e.g. in
nested subroutine calls. I learned about this from the book "Effective Perl Programming"
by Joseph Hall, and Randal Schwartz (Addison Wesley Publ.) Highly recommended!
chas

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

6. Write a simple (common) regular expression to match an IP address, e-mail addr +ess,
city-state-zipcode combination.
You realise those regexes are neither simple nor common, but instead tend to be really
fairly difficult, especially if you had to write one off the top of your head in a somewhat
stressful situation, such as an interview.

As for the rest of your questions, what is the point of asking questions that could be
answered in less than 10 seconds with access to perldoc? Are you just trying to quiz them
on what knowledge they have memorized?

As for the rest of your questions, about what is suitable for perl, presumbably you're
already doing a project in perl, and wish to hire someone to work on this project, so you
know what perl is suitable for, because you've chosen it as a language already! What is
the point of asking if he thinks it's suitable?

Those questions are a strange mixture of absolutely elementary and far more complex.

My answer to "6. Write a simple (common) regular expression to match an IP address


etc" would be "that's not as simple as it sounds. I want to use a module". How would that
score?

I think these questions will just betray to the interviewees that the person interviewing
them doesn't know much about Perl. Perhaps you'd be better off trying to find some Perl
guru local to you who could help out by attending the interviews?
($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss')
=~y~b-v~a-z~s; print

1. What arguments do you frequently use for the Perl interpreter and what
do they mean?

I use -w to turn warnings on, and I use -c to compile code. I also use -d to invoke
the debugger. I never use perl without arguments. That's like driving a car without
a seatbelt, or riding a motorcycle without a helmet.

2. What does the command use strict do and why should you use it?

use strict tells the Perl compiler to be a little pickier about certain syntactical
checking. It's almost never a poor choice.

3. What do the symbols $ @ and % mean when prefixing a variable?

The dollar sign signifies a scalar, the at sign means an array, and the % means a
hash, also known as an associative array.

4. What elements of the Perl language could you use to structure your
code to allow for maximum re-use and maximum readability?

I'm afraid I don't understand the question. I already use Perl for 95% of my
programming, with the reminder in some shell scripting. (I didn't include SQL
answering this question, since it's not procedural when I use it.)

Structuring code has nothing to do with Perl, anyway. It's basic software
craftmanship.

5. What are the characteristics of a project that is well suited to Perl?

Perl is useful when you want to be able to leverage the work of thousands of other
dedicated, excellent programmers available through CPAN modules, when you
want to be able to rapidly prototype, when you want to avoid paying exorbitant
prices for 'development environments', when you want to avoid idiotic vendor
limitations, useless support and incomprehensible documentation.

1. Why do you program in Perl?

Someone once said that "Perl fits your brain like a glove" -- I'm able to get things
done in Perl faster then I ever did using C or awk, and getting things done is how
I earn my salary. In addition, there's a terrific Perl community available for
questions and support.

2. Explain the difference between my and local.

my Creates a new lexical in the current scope; if there is an existing variable with
the same name, you'll get a warning. local does the same thing but 'pushes' the
original value (if it exists) into the background until the current scope is
exhausted.

3. Explain the difference between use and require.

use brings the code in at compile time, where rqeuire pulls the code in at run
time.

4. Whats your favorite module and why?

I don't really have favourite module -- the one that handles file names and
directories is handy, File Special Functions or something like that.

5. What is a hash?

A hash is an unordered associative array, which means it's a variable that contains
multiple elements, where each element is accessed by an associated key, rather
than by an offset (like in an array).

6. Write a simple (common) regular expression to match an IP address, e-


mail address, city-state-zipcode combination.

This question is vague, and I don't have time to prove why.

7. What purpose does each of the following serve: -w, strict, -T ?

You already asked about -w -- that's Perl's command line option for warnings.
You already asken about strict -- you use strict when you want the perl
compiler to do additional syntax checking. The -T command line switch turns on
taint checking, something that's useful for CGIs when you want to make sure
there's no user input that can possibly flow through to the operating system for
security reasons. Typically you want to enable taint-checking as early in the
command line options as possible.

8. What is the difference between for & foreach, exec & system?

for in Perl is like a for loop in C; foreach iterates over a list. exec calls an
external program, never to return, where system calls the external program and
returns.
9. Where do you go for Perl help?

I look in perldoc, in the various O'Reilly books that I have, and finally I visit Perl
Monks.

10. Name an instance where you used a CPAN module.

When I wanted to write a command line utility to log on to a web application


through HTTPS and upload a file, I used LWP::Simple. This saved me huge
amounts of time and sweat.

11. How do you open a file for writing?

I use a '>' in the open statement. I also check that the open succeeded, and if not,
the script dies.

12. How would you replace a char in string and

I could use s/// or tr/// to replace a character in a string, but it depends on the
situation.

.. how do you 13. store the number of replacements?

I think tr/// returns the number of replacements, but I'd have to check.

14. When would you not use Perl for a project?

When either shell scripting will do the job, or when performance is paramount in
which case I'd look at C. There may also be other external factors.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

[reply]
[d/l]
[select] Re: Interview Prepration
by tilly (Archbishop) on Apr 04, 2005 at 03:48 UTC
Answers to these are not going to help you. But I'll fire these off since I'm feeling
bored.

Round 1.

1. What arguments do you frequently use for the Perl interpreter and what
do they mean? Whatever ones are appropriate and they mean what perlrun
says they mean.
2. What does the command ‘use strict’ do and why should you use it? Both
an explanation of what it does and why it is good may be found at
strict.pm. I refer to it as a typo checker.
3. What do the symbols $ @ and % mean when prefixing a variable? The
way that I think about it is that $ means "the", @ means "these", and %
means "dereference as a hash". Note that if you are accessing a single
element of an array or a hash then you use $ for "the" element, and if you
take a slice of an array or a hash then you use @ for "these" items from the
slice.
4. What elements of the Perl language could you use to structure your code
to allow for maximum re-use and maximum readability? The whole
language. I really hope that you're planning to fail someone who blathers
out, "Its support for object-oriented programming" because if you think
that OO is the only path to reusability and maintainability, then you're not
very good at either of those.

Round 2.
5. Why do you program in Perl? Because I'm paid and I enjoy being
productive.
6. Explain the difference between my and local. The local operator is
misnamed, it really means something like "temp". It temporarily replaces a
variable with a new variable, and then when you finally exit your current
scope it replaces the old value. (If you call other functions in other scopes,
the locally set variable is visible.) By contrast my creates a lexical scope,
any references to that variable from the declaration to the brace that ends
your scope refers to the new lexical variable. To underscore that the two
mechanisms are unrelated, note that it is possible to use local on variables
in hashes and arrays. The only reason that you cannot use local on lexical
variables is that Larry Wall thinks that that would be too confusing.
7. Explain the difference between use and require. When you say use Foo
qw(bar baz); you're saying BEGIN {require Foo; Foo-
>import(qw(bar baz));}. (In an interview I could explain that further.)
8. What’s your favorite module and why? There are too many out there to
have a single favorite, but if I had to name one then it would probably be
DBI. In my work I encounter a lot of databases, and a database
driver/interface is necessary piece that I use all of the time that I'm glad
not to have to write.
9. What is a hash? A hash is a kind of datastructure for key/value pairs that
makes average time to access a key, insert a key, or delete a key O(1). If
need be I can explain how they work. They are a native data type in Perl.
In Perl you use %foo to talk about the whole hash, and $foo{bar} to
access one value in the hash. A coding tip. I like naming my hashes in
such a way that hash lookups can be read "of".
10. Write a simple (common) regular expression to match an IP address, e-
mail address, city-state-zipcode combination. I would not handle these
tasks with a single regular expression, and I would advise not hiring
anyone who thinks that they can do so.
11. What purpose does each of the following serve: -w, strict, -T ? They turn
on warnings, make Perl less lenient, and disallow doing dangerous
operations with dangerous data.
12. What is the difference between for & foreach, exec & system? Well for
and foreach are synonyms. You're probably thinking of the difference
between the C-style for (my $i = 0; $i < 10; $i++) {...} and the
clearer Perlish foreach my $i (0..9) {...}. As for the other two, exec
replaces the current process with another, while system pauses the current
program as it runs another one, then returns information about whether
that program succeeded.
13. Where do you go for Perl help? First perldoc. Then my library of books.
Then co-workers. Then perlmonks. In that order.
14. Name an instance where you used a CPAN module. Do I get bonus marks
for using my own CPAN module? :-P
15. How do you open a file for writing? Something like this: open(my $fh,
">", $file) or die "Cannot write to '$file': $!"; Note that the
error message matches the recommendations in perlstyle, and note the use
of 3-argument open as discussed at Two-arg open() considered dangerous.
16. How would you replace a char in string? $string =~ s/$char/
$replacement/g;
17. How do you store the number of replacements? my $count = ($string
=~ s/$char/$replacement/g); Note that the parens are not required,
but I think it is clearer with them included.</code>
18. When would you not use Perl for a project? There are lots of possible
reasons not to use Perl. Performance really is critical. Space really is
critical. The project is to adapt a program written in some other language.
Key developers really hate Perl and the political battle is not worthwhile.
Possible reasons multiply ad nauseum.

[reply]
[d/l]
[select] Re: Interview Prepration
by theorbtwo (Prior) on Apr 04, 2005 at 06:32 UTC

Well, I scanned through the other answers somewhat, but didn't really read them,
and decided that it'd be good pratice to answer them, so here we go...

1. Well, the most common one I use is -e -- for putting a short one-liner on
the command-line. Almost as often, I use -l -- makes print append a "\n"
automatically. (Somewhat annoyingly, -l does not effect printf.) Also, -M,
which is shorthand for use, very useful with -MO=Deparse,-p. Less often,
but still rather common, is -I, shorthand for putting a dir in PERL5LIB /
@INC. (Somewhat different from use lib.) Also, -p and -n are
sometimes useful -- they are shorthand for
2. while (<>)<code> loops, both with and without printing
$_.</li>
3. <li>They give the sort of thing returned by the variable
expression -
4. +- scalar, list, or hashy list. (Note that the obvious --
they are pa
5. +rt of the name, giving the type of variable -- is slightly
wrong in p
6. +erl5, but correct for perl6. The difference is
<code>$foo[1]
[download]

vs @foo[1].

7. Modules and subroutines, including in some cases OO. Also, POD and
comments. Also, refs, and in purticular code refs.
8. This is always a difficult question, for any language. Somewhat easier to
answer is "what are characteristics of a project that make it poorly suited
to Perl". One is if the project is already largely complete in another
language, and the completed part is not easily wrappable in a library.
Another is if the people who should be working on the project do not
know perl, and the other languages they know are decently suited to the
task -- even if perl is better for the project, it may not be worth the
learning curve for this project.
9. I program in Perl because it lets me focus on the bits of the problem that I
wish to. I don't have to manually handle memory management; the
runtime does that for me if I follow a few rules, which I very rarely have
reason to wish to not follow. There are many free and high-quality
libraries available -- I don't have to code my own XML parser, or my own
database interface. The perl community is highly supportive -- if I want
help and advice, I know where I can go to get it quickly, and with a low
occourance of bad advice. Oh, and there is very little that is impossible to
do in perl, and when there is such a thing, I can program just a bit in C,
and the rest in perl, quite easily, by using Inline.
10. my uses lexical scoping: the variable is visible from the statement after the
my until the end of the block that encloses the my statement. This means
that you know where the variable will and won't be visible from just a
glance at the code -- a great improvement from dynamic scoping, which is
what local uses. In dynamic scoping, the variable is visible from the line
following the local statement to the end of the enclosing block, and any
code called from there, and any code called from code called from there,
etc. This means that there's no telling where it will show up, and where it
can be modified, encourging code that is difficult to keep straight in your
head, and where modifications to one piece of code may change the
behavior of other code that, at first glance, appears completely unrelated.
Additionally, dynamicly scoped variables are slightly slower to access.
11. Use takes place at compile time, require takes place at runtime. Use
automatically calls the sub named import in the module being used (unless
the use statement is followed by a pair of empty parens), require does not
call the import sub. Because of this, if you expect the module to do setup
at use time, or export semantics (including subroutines and pragmatic
behaviors), then use "use". If you want it to be effected by the flow of the
program, use require. Otherwise, it's a matter of taste -- most people use
use, mostly because it's slightly shorter.
12. I'd have to go with strict. It makes me more efficent by catching many
of my errors early, and making them easy to find. Not only that, but it
encourages me to think about my scoping, leading me to produce better
code. I use strict in almost every piece of perl I write, and when I don't, I
often end up regretting it.
13. A hash is a mapping from string keys to scalar values. The mapping is
unique and unordered. Dispite this rather humble defintion, it has an
amazing power to create powerful and elegant code; easy-to-use hashes
are one of the simplest reason that Perl is such a wonderful language.
Many other languages have hashes, but they tend to be implemented as a
class of object, which means that the syntax required to access them gets
in the way of what you're actually interested in when reading and writing
code -- the problem you are attempting to slove.
14. Well, none of those problems are purticularly ammenable to writing
simple regexes that match everything they should and nothing they should
not. Fortunately, there is a module, Regexp::Common, that already has
regexes for matching IPs and email addresses. The problem with IPs is
that they require numeric operations to match correctly; not all three-digit
numbers are valid octets. Not only that, but 10.1 is a valid IP address -- it
is an uncommonly used, but quite legal, shorthand for 10.0.0.1. As for
email addresses, while ^/[^ ]@[a-zA-Z0-9-.]+$/ will match most email
addresses, it will not match all email addresses. It will not match the forms
that include comments, nor will it match the @-less form (IE ones that use
the default domain name of the server). It will, however, catch many
things that are not valid email addresses -- those that include a domain
name that does not actually exist, for example. (Many other common
regexes for email addresses will fail more -- for example, many people do
not realize that + is both a valid character for the username part, and a
rather common one. Many people do not realize that some addresses at
registrars have names like noc@cc, with no . in the domain-name part.)
city-state-zip is complex because the comma is sometimes missing
between city and state (in fact, the USPS prefers that it not be there), and
the state may be written as a two-character code, as the correct state name,
or as an incorrect-but-common abbreviation. The ZIP code may be not
present, 5 digits, or 5+4. For that matter, attempting to match against a
regex will miss mailing addresses from outside of the US, fustrating users
and loosing customers.
15. -w enables warnings globally for the perl interpreter. It can be used for
code that needs to maintain compatability with 5.005 and older perls, but
for newer code, use warnings is better, because it will not enable
warnings in parts of the program that are not designed to be run with them
enabled. Strict I mentioned previously, as my favorite module. It disables
constructs that make for unmantaintable code and increased time spent
tracing avoidable errors: implicitly global variables, bareword strings, and
symbolic references. Of course, individual strictures can be turned off for
the portions of code that need them -- most useful for symbolic refs in the
very limited circumstances where they are useful. -T is taint mode. It will
catch certian classes of security issues when dealing with untrusted user
data. However, -T is no replacement for thinking about these issues
explicitly -- it will allow some types of things that should not be allowed,
and will disallow some things that are perfectly safe.
16. There is no difference between for and foreach; they are simply alternate
ways of writing the same thing. Exec and system differ in that exec
replaces your code with some other executable, whereas system creates a
sepperate process. Exec will never return (unless the exec failed); system
will return.
17. That depends on what you mean by "go". If I need perl documentation,
perldoc, perldoc -f, man, perldoc.perl.org, or search.cpan.org, depending
largely on my current environment and mood. If I need to ask other
humans a question, then perlmonks.org -- either Seekers of Perl Wisdom
for written help, or the chatterbox for "spoken" help.
18. I regularly use Finance::Bank::Norisbank -- in fact, I use it exactly every
two hours, from a cron job; it keeps track of activity on my bank account.
I write code that uses HTML::TreeBuilder, LWP::Simple, and
XML::Simple quite often, essensially whenever I want to do a repetitive
task involving the web. I can often write code that preforms a repetitive
task faster then doing it myself, and it is almost always more interesting to
do so.
19. Generally, with IO::Open->new($filename, ">") or die "Couldn't
open $filename for writing: $!";. In some circumstances, of
course, death is not the right thing to do when the file can't be opened, or I
wish to append with >> rather then overwrite with >, or I wish to open the
file in utf8 mode with ">:utf8".
20. $string =~ s/a/b/g
21. my $count = $string =~ s/a/b/g. Sometimes, I use tr/// instead of s///;
tr is more convient when there is a mapping of multiple chars to multiple
chars, and the mapping is more easily expressed explicitly then via code.
22. I already answered this question

Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but
without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of
error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).
[reply]
[d/l]
[select] Re: Interview Prepration
by Anonymous Monk on Apr 04, 2005 at 10:57 UTC
1. Seldomly when using a she-bang line (-T being an exception, and for
quick and dirty hacking, -s), but from the command-line: -w, -p, -n, -a, -i,
-l, -e, -0, -c, -D, -v, -V, -I, -M, -x belong to my favourites. Do I have the
time to explain all of them?
2. use strict is not a command - it's a statement. It compiles the
strict.pm module, and calls the import sub in it. This will twiddle some
bits in $^H, which causes the compiler to check for certain things, and
complain if the conditions aren't met. I don't know whether I should use it,
but I can explain why I often do use it. (insert strictness mantra).
3. It depends a little on the context. It could mean the following variable are
scalars, arrays or hashes, but it could also mean that the following
expression is used as a scalar, list, array or hash.
4. All of them. But perhaps "whitespace" is the most important for
readability (and hence, reusability). Although, technically, "whitespace"
would mean the absence of any element of the Perl language.
5. I believe that "suitable language" is more defined by the programmers
going to do the project than the project itself most of the time, so my
answer would be "if the programmers are Perl programmers".
6. Because I happen to know it, and it often satisfies my needs.
7. my declares a lexical variable (or a set of lexical variables), local creates a
new (or a set of new) value for a non-lexical variable (which is not the
same as a package variable).
8. use is done at compile time, calls import if applicable, and can only be
given a bare word as first argument. require is done at run-time, takes an
expression (or a version) as argument, and doesn't call import.
9. It depends on what I want to do.
10. A mapping that maps strings to arbitrary scalars.
11. IP addresses? In which format? Dotted quads? Hex? 32 bit integers? IPv4?
IPv6? There are no simple regexes for e-mail addresses, unless you either
wants lots of false positives, false negatives, or both. City-state-zipcode of
which country? US? If so, what format zip codes? 5 digits? 5+4? Either?
As for states, 2 letter states? 3 letter states? 2 or 3 letter states? Do you
expect your programmers to remember all 50 abbreviations? There are a
few extra areas that have "state codes" as well? Am I supposed to know
them?
12. -w tests whether a file (or filehandle) is writeable for the EUID, -T guesses
if a file (or filehandle) is an ASCII file, and strict is a bare word that "use
strict;" wouldn't approve off.
13. There's no difference between for and foreach. And system does a fork,
execs in the child, waits in the parent.
14. The manual has all I need.
15. You see, I wanted to write this program ....
16. It depends. There's 2-arg open, 3-arg open, sysopen (either of which can
be used with a filehandle, or a reference to a filehandle as first argument,
and Perl will happely autovivify an undefined value into a reference to a
filehandle for you as well), and modules like IO::File, IO::All, and
Inline::Files. I typically use 2-arg open, 3-arg open and sometimes
sysopen. All three with references to filehandles (usually autovivified
handles) as first argument. Filehandles as first argument is asking for
trouble.
17. _A_ character in a string? As in, a single one? Say, the third character?
substr($str, 2, 1, "x") if length($str) >= 3;
18. Well, that would be either 0 or 1, and it will be 1 if, and only if, the string
originally was at least 3 characters long.
19. If the other programmers don't know Perl. If speed is crucial. If the target
environment has limited resources (memory, disk, CPU). If the source
cannot be distributed. If deployment is going to be a problem. If
portability demands it. If it needs to run in an environment perl doesn't
run in, or can't be installed into. If the customer demands a .NET solution.
If there's a domain specific language far more suitable for the problem
than a generic language like Perl. If low level memory access is a major
part of the solution. If the moon is blue. If I feel like using Java for today.
If it's better done using a Makefile.

[reply]
[d/l]
Re^2: Interview Prepration
by merlyn (Sage) on Apr 04, 2005 at 17:36 UTC
There's no difference between for and foreach.
Ahem. Not this again. Please see what I just said, elsewhere in this thread.

This meme must die. Even if I have to hunt down every appearance of it.
{sigh}

-- Randal L. Schwartz, Perl hacker


Be sure to read my standard disclaimer if this is a reply.

[reply]
Re^3: Interview Prepration
by chromatic (Archbishop) on Apr 04, 2005 at 17:53 UTC

That's a really thin line to walk -- thin enough that I think it's
almost meaningless and definitely more confusing than useful. Is
this a for loop?

foreach ( my $i = 0; $i < 10 ; $i++ )


{
print "\$i is $i\n";
}
[download]

Is this a foreach loop?

for my $user (@names)


{
print "Found user $user\n";
}
[download]
[reply]
[d/l]
[select]
Re^4: Interview Prepration
by merlyn (Sage) on Apr 04, 2005 at 18:04 UTC
Re^5: Interview Prepration
by demerphq (Chancellor) on Apr 05, 2005 at 17:03 UTC
Some notes below your chosen depth have not been
shown here
Re^3: Interview Prepration
by jZed (Prior) on Apr 04, 2005 at 18:02 UTC
The difference between "for" and "foreach" is four characters of
extra typing for the latter. Other than that they are the same.
Because you apparently associate one of the words with a Perl-
style loop and another with a C-style loop is not sufficient reason
to say that "for" is different from "foreach". The words may have a
different history, but their use in scripts is identical.
[reply]
Re^4: Interview Prepration
by merlyn (Sage) on Apr 04, 2005 at 18:08 UTC
Re^5: Interview Prepration
by jZed (Prior) on Apr 04, 2005 at 18:10 UTC
Some notes below your chosen depth have not been
shown here
Re^3: Interview Prepration
by Anonymous Monk on Apr 05, 2005 at 08:48 UTC
Your opinion has been noted. But perl doesn't care about your
opinion, and will treat the keywords for and foreach to be the
same. I'm just answering the interview questions - and I think that
the interview is about probing my perl knowledge, and what I
know about the opinion of some well known members of the Perl
community.
[reply]
Re^4: Interview Prepration
by RazorbladeBidet (Friar) on Apr 05, 2005 at 12:36 UTC
Re: Interview Prepration
by Anonymous Monk on Apr 04, 2005 at 12:44 UTC
try to see if they have a good attitude towards learning and if they will fit in in
your company, instead.
[reply] Re: Interview Prepration
by prostoalex (Scribe) on Apr 04, 2005 at 19:28 UTC

It's actually a copy of Perl Interview Questions from TechInterviews.com.


Judging by the Anonymous Monk's spelling pattern, someone in India with no
Perl knowledge desperately needs a job, no?

[reply]
Re^2: Interview Prepration
by ww (Canon) on Apr 04, 2005 at 19:49 UTC
Actually, that jobseeker interpretation matches mine; namely, that the OP
was looking for the answers in expectation of "being interviewed" as
opposed to "conducting an interview of a prospective employee."

However, there's something else peculiar here: the bottom of the perl
interview page you cite (and link) says: "Check out Perl Monks for
discussion of the questions and related Perl interview issues. Check
RegExpLib for regular expression samples." RegExpLib appears to be site
which provides advertising for regex-related software... but the reference
and link to Perl Monks raise (for me) the further question of whether
someone is using the Monastery's good name as an implied endorsement
of a product?

I should note, tho the pm link is to the Gates, so I suppose the reference
and link could have existed prior to the OP's initiating this thread.

ww, the monk formerly known as "schodckwm"

[reply]
Re^3: Interview Prepration
by merlyn (Sage) on Apr 04, 2005 at 20:01 UTC
Ouch... they put The Monastery and that ugly Regexlib in the same
category? Regexlib is cargo-culted after cargo-culted regex written
by amateur hacks, with very little attention paid to standards and
usability. Eeek.

-- Randal L. Schwartz, Perl hacker


Be sure to read my standard disclaimer if this is a reply.

[reply]
Re^4: Interview Prepration
by Tanktalus (Canon) on Apr 04, 2005 at 20:39 UTC
Re: Interview Prepration
by chris7cmcc (Initiate) on Nov 07, 2006 at 18:56 UTC

RE: local vs. my

local = dynamic scoping:


local my be used to limit the scope of a variable to a specific subroutine and all
subroutines called from it.

my = lexical scoping:

my defines a scope that is limited to a specific subroutine, excluding those called


from within it.

How to install Perl module using CPAN. How to include the module in a program?
Latest Answer: Even though the above answers work as well, I prefer to type cpan at the
command prompt and it brings up the cpan shell prompt. I am using Linux and it may be
OS dependent... ...
Read Answers (4) | Asked by : Tanu_shree
Answer Question Subscribe
Rename Datastage jobs through perl
Please provide me Perl scriptwhich reads the data from xcel sheet and renames the dsx
file.Process followed to rename is:make a list of old and new file names in xcel
sheet.compare the old file name in
Latest Answer: use Win32::OLE;use Win32::OLE::Enum;use Win32::OLE qw(in
with);use Win32::OLE::Const 'Microsoft Excel';use Win32::OLE::Variant;use
Spreadsheet::ParseExcel;use Spreadsheet::WriteExcel;use
Spreadsheet::ParseExcel::SaveParser;use strict;$Win32::OLE::Warn ...
Read Answers (1) | Asked by : s4sweety
Answer Question Subscribe
What is the difference between object oriented and structured oriented progrmming?
Latest Answer: * Object Oriented means programme will be their in terms of Class and
Object relationship will be their.* Structured Oriented Means programme will be their in
terms of multiple Functions. ...
Read Answers (1) | Asked by : sanyogita
Answer Question Subscribe
Symbolic Reference in PERL
What is the Use of Symbolic Reference in PERL?
Latest Answer: > $name = "bam";> $$name = 1; # Sets $bam> ${$name} = 2; # Sets
$bam> ${$name x 2} = 3; # Sets $bambam> $name->[0] = 4; # Sets $bam[0]symbolic
reference means using a string as a reference. ...
Read Answers (1) | Asked by : sapam
Answer Question Subscribe
PERL Symbol Table
What is Symbol table and how it Works?
Latest Answer: Symbol table is a PERL structure which contains the identifier names(like
'variable'). The identifier became actual variable ($variable,@variable etc)Â type when it
associate through typeglob.Symbol table contains only global variables. ...
Read Answers (2) | Asked by : sapam
Answer Question Subscribe
How to find type of variable?
How to find out whether reference is pointing to a scalar, array or hash?
Latest Answer: You can use ref function. ...
Read Answers (3) | Asked by : prabhasgupte
Answer Question Subscribe
Print this array, sorted in reversed case-insensitive order...
You have unsorted array of strings, like:my @arr = qw(hello World Show must go
on);Print this array, sorted in reversed case-insensitive order.
Latest Answer: my @arr = qw(hello World Show must go on);#close print "@arr
nreverse sorted: ", join(", ", reverse sort map {lc $_} @arr), "n"; #closer print "@arr
nreverse sorted: ", join(", ", ...
Read Answers (6) | Asked by : Namataraginu
Answer Question Subscribe
When would you not use Perl for a project?
Latest Answer: Perl programs are generally used for: - text processsing - text mining -
test automation - simple network programming (simple sockets, just fetching webpage
and parsing it) - GUI development with Perl/Tk If ...
Read Answers (1) | Asked by : maverickvistak
Answer Question Subscribe
How do you you check the return code of a command in Perl
Suppose you run a program/script in Perl:system("./server ....");How will you check the
return code?
Latest Answer: Perl defines predefined variable $? which gives the return code of last
command executed. ...
Read Answers (4) | Asked by : mpathak
Answer Question Subscribe
What is -> Symbol in perl
Latest Answer: In object oriented PERL, the arrow -> symbol is used for creating or
accessing a particular object of a class. For eg. in Perl/Tk 1. use Tk; my $main_win =
MainWindow->new(); Here we use -> to create a new object of the class MainWindow ...
Read Answers (5) | Asked by : Rajivcitcse2000

You might also like