1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" id="sixapart-standard">
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <meta name="generator" content="Movable Type 5.2.3" />
8 <link rel="stylesheet" href="http://defaria.com/blogs/Status/styles-site.css" type="text/css" />
9 <link rel="alternate" type="application/atom+xml" title="Atom" href="http://defaria.com/blogs/Status/atom.xml" />
10 <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://defaria.com/blogs/Status/index.xml" />
12 <title>Status for Andrew DeFaria: Perl test</title>
14 <link rel="start" href="http://defaria.com/blogs/Status/" title="Home" />
15 <link rel="prev" href="http://defaria.com/blogs/Status/archives/000517.html" title="Clearcase Merging/CQ Time Stamp problem/CQ Help problem" />
16 <link rel="next" href="http://defaria.com/blogs/Status/archives/000518.html" title="PQA CDO.Message" />
22 <script type="text/javascript" src="http://defaria.com/blogs/Status/mt-site.js"></script>
24 <body class="layout-one-column" onload="individualArchivesOnLoad(commenter_name)">
26 <div id="container-inner" class="pkg">
29 <div id="banner-inner" class="pkg">
30 <h1 id="banner-header"><a href="http://defaria.com/blogs/Status/" accesskey="1">Status for Andrew DeFaria</a></h1>
31 <h2 id="banner-description">Searchable status reports and work log</h2>
36 <div id="pagebody-inner" class="pkg">
38 <div id="alpha-inner" class="pkg">
40 <p class="content-nav">
41 <a href="http://defaria.com/blogs/Status/archives/000517.html">« Clearcase Merging/CQ Time Stamp problem/CQ Help problem</a> |
42 <a href="http://defaria.com/blogs/Status/">Main</a>
43 | <a href="http://defaria.com/blogs/Status/archives/000518.html">PQA CDO.Message »</a>
47 <div class="entry" id="entry-516">
48 <h3 class="entry-header">Perl test</h3>
49 <div class="entry-content">
50 <div class="entry-body">
52 <li>Ray wanted an easy/medium/hard Perl test</li>
55 <div id="more" class="entry-more">
60 <li>What does Perl stand for?</li>
62 <p><font color="red">Practical Extraction and Reporting Language</font></p>
64 <li>What basic datatypes does Perl support?</li>
66 <p><font color="red">Scalar, Array, Hash, Typeglob</font></p>
68 <li>What does the following do:</li>
70 <div class="code"><pre>
71 my @output = <STDIN>;
74 print "$_\n" if /\d+/;
78 <p><font color="red">Echoes lines that have numbers in them)</font></p>
85 <li>What is <tt>use strict</tt> and why is it important to use?</li>
87 <p><font color="red">Strict requires that variable references are scoped - e.g. my $var)</font></p>
89 <li>What does the following code do:</li>
91 <div class="code"><pre>
97 foreach (sort (keys (%p))) {
99 print "$_: <password>\n";
101 print "$_: ${p {$_}}\n";
107 <p><font color="red">Displays the contents of the passed in hash %p substituting "<password>" if the hash happens to have a key of password</font></p>
109 <li>What do you do to enable Perl to find user written modules?</li>
111 <p><font color="red">You need to modify the @INC array to include the path to your modules)</font></p>
117 <li>What is the difference between <tt>require</tt> and <tt>use</tt>?</li>
119 <p><font color="red">See <a href="/blogs/Status/archives/000492.html">this article</a> for the answer</font></p>
121 <li>What is a better way to do the following and why:</li>
123 <div class="code"><pre>
127 <p><font color="red">See <a href="/blogs/Status/archives/000492.html">this article</a>) for the answer</font></p>
129 <li>What does the following print out when executed:</li>
131 <div class="code"><pre>
135 my @z = `$x 2>&1`; chomp @z;
140 print "$_\n" foreach (@z);
152 print "Worked!\n" if !$d;
155 <p><font color="red">(It will output:</p>
157 <div class="code"><pre>
161 <p>Yet nothing really worked at all! Key issues are:</p>
164 <li>Passing parameters to subroutines. Two parameters are passed in</li>
166 <li>Parameter return: Two parameters are returned</li>
168 <li>Evaluation of parameters: $y in foo is not passed in thus the print... foreach doesn't execute></li>
170 <li>Evaluation of true/false: foo returns $y which is errno,
171 which is not 0 thus not true but the !$d evaluates to true and the
172 print "Worked!\n" gets executed.</li>
178 <p class="entry-footer">
179 <span class="post-footers">Posted by on January 13, 2006 11:59 AM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000516.html">Permalink</a>