source.by

Perl as powerful and flexible tool for Unix system administrators and defensive programming in Perl

Source 2020: http://www.softpanorama.org/Scripting/perl.shtml | 2020-02-10

        <html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Perl as powerful and flexible tool for Unix system administrators and defensive programming in Perl</title>
<link rel="stylesheet" type="text/css" href="../CSS/main.css"></head>

<body>

<basefont face="Times" size="3">
<table border="0" width="100%" id="table1" cellspacing="1" cellpadding="4"  >
<tr>
<td rowspan="2" width="40%">

<p align="center"><img border="0" src="/Images/splogo.gif" width="45"  ><font face="Bernard MT Condensed" color="#FF0000" size="7">
<font color="#FF0000"><a href="/index.shtml">Softpanorama</a></font></font></p>
</td>
<td align="center">

<b><a href="/index.shtml"><font size="2">Home</font></a></b></td>
<td align="center">

<b><a href="/switchboard.shtml"><font size="2">Switchboard</font></a></b></td>
<td align="center">

<b><a href="/Admin/index.shtml"><font size="2">Unix Administration</font></a></b></td>
<td align="center">

<b><a href="/Commercial_linuxes/RHEL/index.shtml"><font size="2">Red Hat</font></a></b></td>
<td align="center">

<b><a href="/Net/index.shtml"><font size="2">TCP/IP Networks</font></a></b></td>
<td align="center">

<b><a href="/Skeptics/Political_skeptic/Neoliberalism/index.shtml"><font size="2">Neoliberalism</font></a></b></td>
<td align="center">

<b><a href="/Social/Toxic_managers/index.shtml"><font size="2">Toxic Managers</font></a></b></td>
</tr>
<tr>
<td colspan="7" align="center">

<font size="2" face="Arial"><b>May the source be with you, but remember the KISS principle ;-) <i><br>
</i>Skepticism and critical thinking is not panacea, but can help to understand the world better<i> </i></b></font></td>
</tr>
</table>
<hr width="100%" noshade size="5" color="#FF0000">
<center>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- top_large_banner -->
<ins class="adsbygoogle"
     style="display:inline-block;width:970px;height:90px"
     data-ad-client="ca-pub-4031247137266443"
     data-ad-slot="9138796897"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>


<h1>Perl as powerful and flexible tool for Unix system administrators and defensive programming in Perl</h1>

<h3>Perl was developed as the language for processing logs for NSA, <br>
then emerged as the language of choice for elite Unix sysadmins, <br>
then enjoyed a short love affair with CGI programming but quickly was displaced by PHP <br>
(PHP started out as a set of "Perl hacks" and cloned many Perl features), <br>
and now returned to its roots -- it again became the language for elite Unix sysadmins</h3>

<table border="1" width="100%" cellspacing="1" bordercolordark="#FFFFFF" bordercolorlight="#000000">
   <tr>
      <td width="12%" bgcolor="#FFFFCC" align="center">

      <p align="center"><a href="#News">News</a> </p>
      </td>
      <td width="12%" bgcolor="#FFFFCC" align="center">

      <p align="center"><b><a href="index.shtml">Scripting Languages </a></b></p>
      </td>
      <td width="12%" bgcolor="#FFFFCC" align="center">

      <p align="center"><a target="_blank" href="Perlbook/index.shtml"><b>eBook: </b></a><b>
      <a target="_blank" href="Perlbook/index.shtml">Perl for system admins</a></b></p>
      </td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a target="_blank" href="../Bookshelf/Computers/perl.shtml">Recommended Perl 
      Books</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><a href="#Recommended_Links">Recommended Links</a></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"><b><a href="../SE/defensive_programming.shtml">Defensive programming</a></b></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"><b><a target="_blank" href="Perlorama/perl_language.shtml">Perl Language</a></b></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"><b><a href="Perlorama/Reference/index.shtml">Perl Reference</a></b></td>
   </tr>
   <tr>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a href="Perlorama/perl_in_command_line.shtml">Perl as a command line tool</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a href="Perlorama/Regex/index.shtml">Perl Regular Expressions</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a href="Perlbook/Ch05/regex_overview.shtml">Overview of Perl regular expressions</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a href="Perlbook/Ch05/more_complex_regex.shtml">More Complex Perl Regular 
      Expressions</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a href="Perlorama/perl_namespaces.shtml">Perl namespaces</a></b></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"><b><a href="Perlorama/perl_modules.shtml">Perl modules</a></b></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"><b><a href="Perlbook/Ch06/index.shtml">Subroutines and Functions</a></b></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"><b><a href="pipes.shtml">Pipes </a></b></td>
   </tr>
   <tr>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a target="_blank" href="Perlorama/perl_debugging.shtml">Perl Debugging</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><a target="_blank" href="Perlorama/applications.shtml"><b>Perl a</b></a><b><a target="_blank" href="Perlorama/applications.shtml">pplications</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a href="Perlorama/One-liners/index.shtml">Perl One Liners</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a href="Perlbook/Ch05/html_matching_examples.shtml">HTML Matching Examples</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a href="Perlorama/perl_programming_environment.shtml">Perl IDE</a></b></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"><b><a href="Perlorama/perl_certification.shtml">Perl Certification</a></b></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"><b><a href="Perlbook/Ch01/perl_hype.shtml">Notes on Perl Hype</a></b></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"><b><a href="Perlorama/perl_for_win32.shtml">Perl for Win32</a></b></td>
   </tr>
   <tr>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a target="_blank" href="Perlorama/perl_style.shtml">Perl Style</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a href="../Utilities/beautifiers.shtml">Beautifiers and Pretty Printers</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a href="../Utilities/Beautifiers/neatperl.shtml">Neatperl -- a simple Perl 
      prettyprinter</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"> <b><a href="Perlorama/perl_xref.shtml">Perl Xref</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a href="Perlorama/perl_power_tools.shtml">Perl power tools</a></b></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"><b><a href="Perlorama/perl_programming_environment.shtml">Perl IDE and Programming 
      Environment</a></b></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"><a target="_blank" href="../People/Wall/perl_warts_and_quirks.shtml"><b>Perl Warts</b></a></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"><b><a href="Perlorama/Debugging/perl_error_checklist.shtml">Perl Error Checklist</a></b></td>
   </tr>
   <tr>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a target="_blank" href="../People/Wall/index.shtml">Larry Wall</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a href="../People/Wall/larry_wall_articles_and_interviews.shtml">Larry Wall 
      Articles and Interviews</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><a href="Perlbook/Ch01/perl_history.shtml"><b>Perl evolution</b></a></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b> <a href="Perlorama/History/index.shtml">Perl history</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a href="../People/Wall/perl_related_humor.shtml">Perl-related Humor</a></b></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"><b><a href="../People/Wall/Interviews/larry_wall_on_perl2002.shtml">Larry 
      Wall On Perl, Sep 06 2002</a></b></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"><b>
      <a href="../People/Wall/Interviews/larry_wall_computerworld_interview2008.shtml">Larry Wall Computerworld Interview, 2008</a></b></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"><a href="../People/Wall/Interviews/linux_format2009.shtml">Larry Wall 
      interview to Linux Format, Aug 14, 2009</a></td>
   </tr>
   <tr>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a href="Perlorama/pod_documentation.shtml">Perl POD documentation</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a href="Perlorama/articles.shtml">Annotated Perl Articles</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a href="../Lang/quotes.shtml">Quotes</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a href="https://en.wikiquote.org/wiki/Larry_Wall">Larry Wall - Wikiquote</a></b></td>
      <td width="12%" bgcolor="#FFFFCC" align="center"><b><a target="_blank" href="Perlorama/perl_tips.shtml">Tips</a></b></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"><b><a href="../Admin/admin_horror_stories.shtml">Sysadmin Horror Stories</a></b></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"><b><a target="_blank" href="../People/Wall/perl_related_humor.shtml">Humor</a></b></td>
      <td width="13%" bgcolor="#FFFFCC" align="center"> </td>
   </tr>
</table>


<table border="0" width="178" height="620" align="right" cellspacing="4" bgcolor="#FFFFFF">
   <tr>
      <td>

      <table border="1" width="174" height="616" align="center" bgcolor="#FF0000">
         <tr>
            <td>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Upper skyscaper -->
<ins class="adsbygoogle"
     style="display:inline-block;width:160px;height:600px"
     data-ad-client="ca-pub-4031247137266443"
     data-ad-slot="0371843916"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
            </td>
         </tr>
      </table></td>
   </tr>
</table>
<ul>

   <li><b><a href="#Introduction">Introduction</a></b></li>

   <li><b><a href="#Is_Perl_dying_">Is Perl dying ?</a></b></li>

   <li><b><a href="#Evolution_of_Perl">Evolution of Perl</a></b></li>

   <li><b><a href="#Perl_debugger">Perl debugger is one of better kept secrets of the language. It is an amazingly powerful tool</a>
   </b></li>

   <li><b><a href="#Perl_is_installed_by_default">Perl is installed by default in all flavors of Linux and all other enterprise 
   flavors of Unix (Solaris, HP-UX and AIX)</a></b></li>

   <li><b><a href="#What_Softpanorama_can_offer_people_who_want_to_learn_Perl">What Softpanorama can offer to sysadmins who want to learn 
   Perl</a></b></li>

   <li><b><a href="#Adapting_to_the_language_quirks_and_warts">Adapting to the language quirks and warts</a></b></li>

   <li><b><a href="#Benefits_that_Perl_brings_to_system_administration">Benefits that Perl brings to system administration</a></b></li>

   <li><b><a href="#A_warning_about_relative_popularity">A warning about relative popularity</a></b></li>

   <li><b><a href="#The_most_common_versions_of_Perl__5_in_production">The most common versions of Perl  5 in production</a></b></li>

   <li><b><a href="#The_problem_of_Perl_complexity_junkies">The problem of Perl complexity junkies</a></b></li>

   <li><b><a href="#Tips">Tips</a></b><ul>

      <li><a href="#Missing_semicolon_problem_in_Perl">Missing semicolon problem in Perl</a></li>

      <li><a href="#Avoiding_mistyping_=_instead_of_==_blunders">Avoiding mistyping "=" instead of "==" blunders</a></li>

      <li><a href="#Locating_unbalanced_}__errors">Locating unbalanced "}"  errors</a></li>

      <li><a href="#Problem_of_unclosed_quote_at_the_end_of_the_line_string_literal__(...)_">Problem of unclosed quote at the end of 
      the line string literal ("...")</a></li>

      <li><a href="#How_to_avoid_using_wrong_comparison_operator_comparing_two_variable_">How to avoid using wrong comparison operator 
      comparing two variable</a></li>
   </ul>
   </li>

   <li><b><a href="#Perl_as_a_new_programming_paradigm">Perl as a new programming paradigm</a></b></li>

   <li><b><a href="#References_are_major_Perl_innovation">References are major Perl innovation</a></b></li>

   <li><b><a href="#Perl_has_a_great_debugger">Perl has a great debugger</a></b></li>

   <li><b><a href="#Brilliance_of_Perl_Artistic_license">Brilliance of Perl Artistic license</a></b></li>

   <li><b><a href="#Perl_warts">Perl warts</a></b><ul>

      <li><a href="#Language_design_warts">Language design warts</a></li>

      <li><a href="#Absence_of_good_development_environment">Absence of good development environment</a></li>

      <li><a href="#Lost_development_track">Lost development track</a></li>

      <li><a href="#Problems_with_Perl_5._22">Problems with Perl 5.22</a></li>
   </ul>
   </li>
</ul>
<hr noshade color="#FF0000" width="33%" size="7">

<h3><a name="Introduction">Introduction</a></h3>

<table border="0" width="80%">
   <tr>
      <td width="33%"> </td>
      <td>
      <ul>

         <li><FONT face=Arial size=2>Anything that can go wrong will go 
  wrong.</FONT></li>

         <li><FONT face=Arial size=2>Nothing in programming is as easy as it looks. Everything 
  takes at least twice longer than you think.</FONT></li>

         <li><FONT face=Arial size=2>If there is a possibility of several things going wrong, the one 
  that will cause the most damage will be the one to go wrong.</FONT><ul>

            <li><FONT face=Arial size=2><i><b>Corollary: </b></i>If there is a worse time for something to 
  go wrong, it will happen then.</FONT></li>
         </ul>
         </li>

         <li><FONT face=Arial size=2>If anything simply cannot go wrong, it will 
  anyway. If you perceive that there are four possible ways in which a 
  procedure can receive wrong  parameters, there is always be a fifth way.</FONT></li>

         <li><FONT face=Arial size=2>Due to maintenance and enhancements which breaks 
      conceptual integrity programs tend to degenerate from bad to worse and number of bugs in later version does not decrease. 
         It increases. </FONT></li>

         <li><FONT face=Arial size=2>If logs suggest everything seems to be going well, you have obviously 
  overlooked something.</FONT></li>

         <li><FONT face=Arial size=2>Hardware always sides with the flaws in software.</FONT></li>

         <li><FONT face=Arial size=2>It is extremely difficult to make a program foolproof because 
  fools are so ingenious.</FONT></li>

         <li><FONT face=Arial size=2>Whenever you set out to do something really important, something else comes out that should be done first.</FONT></li>

         <li><FONT face=Arial size=2>Every solution 
      of a problem breeds new 
  problems, often more nasty... </FONT></li>
      </ul>

      <p align="right"><i><font face="Arial">Murphy laws of engineering<br>
      (author adaptation)</font></i></td>
   </tr>
</table>

<p>Defensive programming is a style of programming which stems from programming style adopted by compiler writers who represent the elite of the programming 
community and includes such names as:</p>
<ul>

   <li><b>John Backus</b> (the first <a href="https://en.wikipedia.org/wiki/Fortran">Fortran complier</a> delivered April 1957), 
   </li>

   <li><b>Melvin Conway</b> (who invented the coroutine concept and applied it to the
   <a href="http://www.melconway.com/Home/pdf/compiler.pdf">COBOL compiler 
development</a>; also of <b><a href="../SE/conway_law.shtml">Conway Law</a></b> fame(1968) ) , </li>

   <li><b>Donald Knuth </b>(who started his career as a complier writer and implemented one of the first Algol 
compilers <a href="https://datatron.blogspot.com/2015/11/knuths-algol-58-compiler.html">The Burroughs 205 and 220 Knuth's 
Algol-58 Compiler</a>),</li>

   <li><b><a title href="https://en.wikipedia.org/wiki/Edsger_W._Dijkstra">Edsger W. Dijkstra</a> and
   <a title="nl:Jaap Zonneveld" class="extiw" href="https://nl.wikipedia.org/wiki/Jaap_Zonneveld">Jaap A. Zonneveld</a></b> (one of 
   the first Algol 
   60 complier, August 1960), </li>

   <li><b><a title href="https://en.wikipedia.org/wiki/Ole-Johan_Dahl">Ole-Johan Dahl</a> and
   <a title="Kristen Nygaard" href="https://en.wikipedia.org/wiki/Kristen_Nygaard">Kristen Nygaard</a></b>. (Simula I and Simula 
   67), </li>

   <li><b>Thomson and Richie</b> (C language and C complier; Unix OS),  </li>

   <li><b>Nicklaus Wirth</b> (Algol W, Pascal, Modula, Modula II), </li>

   <li><b>R. A. FREIBURGHOUSE</b> (<a href="https://www.multicians.org/pl1-raf.html">Multics 
PL/1 complier</a>), </li>

   <li><b>Gary Kildall</b> ( <a href="https://en.wikipedia.org/wiki/PL/M">PL/M</a> and later CP/M OS; PL-G complier), </li>

   <li><b>Richard Stallman</b> (gcc) </li>

   <li><b>Richard W. Conway and Thomas R. Wilcox</b> 
(of PL/C -- Cornell diagnostic compiler -- fame), </li>

   <li><b>Brian Marks</b> ( the head of team which developed famous PL/1 checkout compiler, aka the Checker)  </li>

   <li><b>David Gries</b> (author of the book
   <a href="https://www.amazon.com/Compiler-Construction-Digital-Computers-David/dp/047132776X/ref=sr_1_3?keywords=David+Gries&qid=1567189023&s=gateway&sr=8-3">Compiler Construction for Digital Computers</a> 
   -- one of the first books on compiler construction ),  </li>
</ul>

<p>and many other. We can add several people who developed scripting language interpreters:
</p>
<ul>

   <li><b>Mike Cowlishaw</b> (REXX, 1982); REXX was the first scripting language and it was a precursor to all later languages. 
   Still used as macrolanguage in Kedit, THE and ZOC terminal emulator. </li>

   <li><b>Alfred Aho, Peter Weinberger, and Brian Kernighan (AWK, </b>1977<b>; redesigned version in 1988); </b>BTW Alfred Aho also 
   is the author of egrep</li>

   <li><b>Larry Wall</b> (Perl, 1987), </li>

   <li><b><a href="https://en.wikipedia.org/wiki/Guido_van_Rossum">Guido van Rossum</a></b> (Python, 1990)  </li>
</ul>

<p>You can only design and write a few compilers from a reasonably complex language in 
your lifetime (Nicklaus Wirth manages to write three, and while the languages involved were not on the level of complexity of PL/1 
or Perl, this probably is a record).  Besides the complexity of the code generation, hardware moves head for those years you 
are writing it, making some compromises during the design phase obsolete. So creating a solid architecture of a portable complier 
for a particular language correctly guessing trends in hardware for the next several years and writing a successful is a high art of 
system programming. The art which can be 
mastered  by a few especially gifted programmers.  
</p>

<p>The basic idea behind this approach is to write the program like a compiler so that it is able to run properly even through unforeseen 
input by users. In many ways, the concept of defensive programming is much like that of defensive driving, in that it tried to anticipate problems 
before they arise. One common feature is the ability handle strange input without crashing or creating a disaster.
</p>

<p>In a way, defensive programming tried to eliminate many bugs before they happen. The classic example of "non-defensive" 
programming is the absence of checking of a return 
code for an external routine or some Unix utility. This type of bugs often slips in production code and they are discovered only 
during production runs, possibly many years from initial release of the product, often at a great cost. Just enforcement of the rule that no external module or utility can be used without 
checking its return code prevent many bugs from happening.  
</p>

<p>In general the deeper in development cycle you find the bug, the 
more costly it is for fix. So while defensive programming might produce some minor overhead in both source code lines count and the run time (which for system utilities 
does not matter at all)  it dramatically cheapens the total development costs as fewer bugs slip into most costly for detention 
and elimination stage: the production phase. 
</p>

<p>That essentially means that that the program is written in such way that it is able to able to protect itself against 
all invalid inputs. Which is the standard behaviour of the complier, but which can be extended to other types of programs.  It 
also emphasizes the quality of diagnostic of wrong inputs and situations and "intelligent" dealing with those that still can 
guarantee the correct results.
</p>

<p>The invalid inputs (aka bad data) can come from user input via the command line, as a result undetected errors on other 
parts of the program, as a special conditions related to various objects such as file (i/o error in the file, missing file, insufficient permissions, etc). 
Bad data can also come from other routines in your program via input parameters. Defensive programming is greatly facilitated by an 
awareness of specific, typical blunders (aka SNAFU),  and vulnerabilities ( for example for sysadmin scripts and utilities a collection of "<b><a href="../Admin/admin_horror_stories.shtml">Horror 
Stories</a></b>"  exists; see for example <a href="../Admin/Horror_stories/creative_uses_of_rm.shtml">Creative uses of rm</a> )
</p>

<p>In other words, defensive programming is about making the software work in a predictable manner in spite of unexpected inputs.</p>

<p>Another "re-incarnation" of this concept can be traced to the period of creation of ADA programming language (1977-1983) or even earlier 
in the context of writing real time software.   
Former DOD standard for large scale safety critical software development emphasized encapsulation, data hiding, strong typing of data, 
minimization of dependencies between parts to minimize impact of fixes and changes. Which is the right dose (determining of which 
requires programming talent) can improve the quality of programs and simplify ( but not necessary shorten ) the debugging and 
testing stages of program development. </p>

<p>One typical problem in large software modification is that creating changes by person who is not the original developer often 
damages conceptual integrity of the product. In this case fixing one problem creates multiple others still to be detected and fixed 
(one step forward, two steps back).  One way to fight this problem 
of "increasing entropy with age" or loss of conceptual integrity is to institute a set of  sanity checks which detect abnormal 
parameters values (assertions or some similar mechanism). In most systems resulting overhead is negligible as such check usually are 
administered outside the most inner loops. but the positive 
effect is great.  </p>

<p>Many people independently came to the subset of ideas of defensive programming, so it is impossible to attribute this concept to 
a single author. As an example of early attempt to formulate some principles of defensive programming style we can list  Tom Christiansen recommendations 
(Jan 1, 1998) for Perl language. Perl does not have strict typing of variables and, by default, does not  require any declaration 
of variables, creating potential for misspelled variables slipping into production version of the program. (unless you use <tt>strict</tt> pragma 
-- the use the latter became standard in modern Perl). While they are more then 20 years old they are still relevant:   </p>
<ul>

   <li><tt>use strict </tt></li>

   <li><tt>#!/usr/bin/perl -w </tt></li>

   <li><em>Check all syscall return values, printing</em> $! </li>

   <li><em>Watch for external program failures in</em> $? </li>

   <li>Check $@ after <code>eval""</code> or <code>s///ee</code>. </li>

   <li>[Use] Parameter asserts </li>

   <li><tt>#!/usr/bin/perl -T</tt>  (taint mode in which Perl distrust any data from outside world, see below)</li>

   <li>Always have an <code>else</code> after a chain of <code>elsif</code>s </li>

   <li>Put commas at the end of lists to so your program won't break if someone inserts another item at the end of the list.</li>
</ul>

<p>Out of those the most interesting is taint option (strict is also interesting but it simply partially fixes oversights in the 
initial design of the language; Python uses more sound idea of typing values and requires explicit conversion between values of different 
types). Here is a quote from <a href="https://www.perl.com/pub/2004/08/09/commandline.html">Perl Command-Line Options - Perl.com</a>:
</p>
<blockquote>

   <p>The final safety net is the <code>-T</code> option. This option puts Perl into "taint mode." In this mode, Perl inherently distrusts 
   any data that it receives from outside the program's source -- for example, data passed in on the command line, read from a file, 
   or taken from CGI parameters.</p>

   <p>Tainted data cannot be used in an expression that interacts with the outside world -- for example, you can't use it in a call 
   to <code>system</code> or as the name of a file to open. The full list of restrictions is given in the <code>perlsec</code> manual 
   page.</p>

   <p><em>In order to use this data in any of these potentially dangerous operations you need to untaint it. You do this by checking it 
   against a regular expression.</em> A detailed discussion of taint mode would fill an article all by itself so I won't go into any more 
   details here, but using taint mode is a very good habit to get into -- particularly if you are writing programs (like CGI programs) 
   that take unknown input from users.</p>
</blockquote>

<h3><a name="Is_Perl_dying_">Is Perl dying ? No, it remains an essential and very popular tool for system administrators,</a><br>
<a name="Is_Perl_dying_">probably the best second 
language after BASH unless you learned Python at the college</a></h3>

<p>There are a lot well-meaning and not so well meaning  pundits who claim that Perl is dying, etc. But after language became 
widespread and complier/interpreter is still supported and is included into all major OSes, it can only fade but never die. Just look at the Fortran. 
</p>
<p>Development recently became really problematic. For example on Feb 16, 2020 Cygwin updated Perl from 5.34 to 5.30. Perl 5.30.1 included in Cygwin is so buggy 
that it is unusable.  File predicate -s -- the size of the file  ( as in -s file) does not work. </p>
<blockquote>
	<ul>
		<li><em>From</em>: Achim Gratz <Stromeko at nexgo dot de></li>
		<li><em>To</em>: cygwin at cygwin dot com</li>
		<li><em>Date</em>: Sun, 16 Feb 2020 21:32:46 +0100</li>
		<li><em>Subject</em>: [ANNOUNCEMENT] Updated: perl-5.30.1-1 and Perl distributions</li>
		<li><em>Reply-to</em>: cygwin at cygwin dot com</li>
	</ul>
	<pre>Perl 5.30.1-1 is now available on Cygwin, replacing perl-5.26.3-2.  Most Perl distributions and dependent packages have been either re-released or updated in conjunction with this update, for exceptions please refer
to the list below.</pre>
	<pre>Release notes:
<a rel="nofollow" href="https://metacpan.org/release/SHAY/perl-5.30.1">https://metacpan.org/release/SHAY/perl-5.30.1</a></pre>
</blockquote>
<p> Previous version 5.26.3 worked reliably. This push for Perl 5.30 greatly undermined value of Cygwin for those 
who use it as the Perl platform. But older version like 5.10 and 5.14 are still OK and can be used. 
</p>

<p>As for Python popularity it is connected with the power of modern computers. On computers typical for say 1996 Python did not 
stand a chance. Yo asset the level of overhead Python impose on programmer  watch
<a href="https://www.youtube.com/watch?v=E_kZDvwofHY">Advanced Python or Understanding Python - YouTube</a>. This is pretty 
realistic assessment  of the complexity of the Python (and by extension inefficiency of its implementation). All this public 
masturbation with multiple inheritance and other esoteric concepts are so far from problems sysadmin need to solve that you probably 
should stay clear of this language put of principle, unless Perl get into real trouble. You better try to learn Golang instead, as, 
at least, it is faster then Python ten times or more :-).  Go deliberately omits certain OO features that does not have much 
value but increase overhead, including inheritance and generic programming: two favorite topics of language complexity junkies. 
</p>

<p>Perl has an interesting historical path: from a language for elite system administrators to mass Web development  language 
and back to the tool for elite system administrators.  Several (or may be most) early adopters of Perl such as 
<a href="https://www.socallinuxexpo.org/scale12x-supporting/default/files/presentations/my%20half%20life%20with%20Perl.pdf">Randal 
L. Schwartz</a>  and <a href="https://en.wikipedia.org/wiki/Tom_Christiansen">Tom Christiansen</a> (author of
<a href="http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/">Csh Programming Considered Harmful</a>, 1995  ) were outstanding 
Unix  system administrators. 
</p>

<center>
<table border="2" width="90%" bgcolor="#FFFF00">
   <tr>
      <td><b>Perl has an interesting historical path: from a language for elite system administrators to mass Web development 
      language, and back to the tool for elite system administrators</b></td>
   </tr>
</table>
</center>

<p>Perl is here to stay at least for the community of elite Unix sysadmin (which is a large community and it is the community in which 
Perl started), because it is a natural fit. It was created by a sysadmin and carry a lot of 
commonality with classic Unix tool set. And first of all with Unix shell, which is the language which all sysadmin known and use.  
In this respect it beats Python and Ruby hands down. Both Python and Ruby also carry too heavy OO baggage and that's also diminishes 
their value as sysadmin tools -- only few tasks in system administration area can benefit from OO approach. You can appreciate Perl 
more (and also see Python more realistically despite all hype) if you try to write a couple of utilities for sysadmin work in 
Python.  Then you would instantly understand how fake are cries about Python superiority over Perl. At least in this particular 
domain.  Languages are really similar in power, but Perl 5 is much more convenient to use despite worse type system, necessity 
to put  semicolons at the end of statements and other annoyances.  Another thing that you will understand is that claim 
that Python is  orthogonal and Perl is baroque language is not quite true. Python pushed a lot of complexity into 
modules/libraries (which are extremely baroque and some of them badly architectured) and that backfired. It also discard several 
typical for people who program in C constructs (no C-style for loop; no  ++ and --  for no obvious reason.) That reminds 
me idiotism of some language construction decisions in Pascal which has for loop with increate one and only one ;-) And several 
popular construct of Perl are not very well emulated in Python. We can start with double quotes, concept of "undef", etc :-) . 
Neither language cal be mastered in full by mere mortals: you always use some subset and need to consult documentation each time you 
use some rarely used part of the language.  and  re-learn it again and again.  And Python related OO-hype is what it 
is -- hype -- OO does not help much in writing system programs.  Modules and explicit  control over namespaces are two 
things that usually all you need  and want. </p>

<p>Now the idea of Perl 6 is dead, it mutated is the separate  language (Roku) and that's good. One can see that in Perl 6 OO 
zealots prevail over  more  cooler heads and it try to use paradigm<span itemprop="name"> used in 
Python and Ruby  competing with  them in the same space. Looks like Larry Wall bough OO hype "hook, line and sinker"</span>, and that was a questionable decision, making  Perl 6 "Jonny come lately" 
in this category.  There were several much simpler areas were Perl 5 could be more profitably be extended such as exceptions, 
coroutines and, especially, introducing types of variables (forced conversion based on operator used (borrowed from Unix shell) is 
probably one on the most serious problems with Perl 5, and it definitely inferior to "lazy types" used n Python, when a variable 
carries its type after the initial assignment (but Python fall into other extreme -- it prohibited automatic conversion even in 
cases when it is relatively safe.) Actually static types are even better that lazy typing  and that's what should be used (GO 
has static  types and now eats Python lunch rising  to the top three in GitHub).  </p>

<p>OO does not matter much for writing system utilities, because in this case (unlike say GUI with multiple windows) there no useful 
application of the concept of class with multiple instances. It is also sad that Larry Wall also did not realize that Javascript <i>
<b>prototypes</b></i> based OO model is a 
much better implementation of OO then Simula-67 model. </p>

<p>In any case Perl 5 modules do 80% of what is useful in classes (namely provide a 
separate namespace and the ability to share variables in this namespace between several subroutines) without any OO. If you wish, a primitive constructor  
that initialize variable (for example <tt>state</tt> variables) can be implemented as a BEGIN block.  And for a medium to large 
programs the control of the namespace is what matters most. </p>

<p>This synergy with Unix shell and access to Unix API alone makes Perl preferable language for writing small utilities which can help of automate sysadmin tasks -- the main use of any 
scripting language for sysadmins. As it is partially was created as an attempt to merge shell and AWK on a new level it has strong 
conceptual linkage to bash.  <span class="ui_qtext_rendered_qtext">It is , essentially Borne shell that would be created if
</span><a href="https://en.wikipedia.org/wiki/Stephen_R._Bourne"> Stephen_R._Bourne</a><span class="ui_qtext_rendered_qtext">  
was replaced by the developers of AWK ;-) </span> </p>

<p><span class="ui_qtext_rendered_qtext">As of 2019 Perl remains one of the major  scripting languages and has probably the 
second largest amount of production code running of any scripting language, although most of it was written a while ago. It is not 
that visible on GitHub, but you understand that Github store many vanity and dead projects, so total muber of project using 
particular language does notmatter much. Only projects with 100 or more stars matter. Outside 
system administration, few large system development projects now use Perl ( </span><a href="https://bioperl.org/">bioperl.org</a><span class="ui_qtext_rendered_qtext"> 
was probably the last large project of this type and it is gradually is replaced by </span><a href="https://biopython.org/">
biopython</a><span class="ui_qtext_rendered_qtext">). In the past several large Web sites such as Yahoo and Amazon used Perl as the 
programming language.  </span> </p>

<p>Perl no longer is used much for Web development, but the level of suitability to sysadmin tasks was and remain unsurpassed.  Because Python is used in Universities for 
teaching programming it became more popular for sysadmin tasks as well, but Perl in this niche still is superior to any viable alternative 
including Python.   So Python ascendance was not only due to the quality of the language and its implementation, but also 
due to so called "Peter Naur effect":  Peter Naur (of Algol 60 report and BNF notation fame) in his
<a href="https://www.deepdyve.com/lp/association-for-computing-machinery/programming-languages-natural-languages-and-mathematics-wv0NeiAEl0">
1975 lecture</a>  "Programming languages, natural languages, and mathematics" which later was reprinted in <!--[if gt IE 8]>his 
book <a href="https://www.amazon.com/Computing-Activity-Anthology-Peter-Naur/dp/0201580691">Computing: A Human Activity</a> (1992), 
<![endif]-->
hypothesized that since late 70th  only those future languages what  can be thought to beginners have changes to enter the 
"main" programming languages space. All others are limited to niche applications.  In this sense Perl is a clear violation of 
Peter Naur hypothesis ;-). </p>

<p>Anther important factor in Perl success is that Perl is a very interesting language with highly unorthodox design, which despite 
its warts produced a lot of innovative, even for this day concepts. As such it is attractive to elite programmers and system 
administrators who can master the language complexity and benefit form its expressiveness. For example it is one of the few 
scripting languages which has concept of pointers as a data type, much like C. Also it is unique in a sense that has explicit 
directives (package) for managing namespace. Not to say an excellent access to Unix internals (<b><a target="_blank" href="../People/Wall/index.shtml">Larry 
Wall</a></b> was a "superstar" Unix system administrator and it shows) </p>

<p>Perl also has several very well written textbooks although latest popular O'Reilly books are mostly junk as they were captured 
clueless OO advocates (see
      <a target="_blank" href="Perlbook/index.shtml">Perl for system admins</a> for extended discussion).<b>
      </b>Perl pioneered huge 
testing suit for the language and is very stable.   Versions 5.8.8 used in older Linux version (like RHEL 5) and version 5.10 
that is used on many current Linux distributions are very stable indeed. Version 5.10 is preferable as it introduced several new features 
useful for sysadmin tasks and first of all <tt>state</tt> variables -- variable that can be declared in subroutines but which behave like 
static variable and are not reinitialized on entry to the subroutine.   Also <tt>strict</tt> mode helps to cope with the problem of 
contextual declaration of variables, which the source of nasty and difficult to find errors as misspelled variables are viewed as just 
another variable with the default initial value. </p>

<p>Perl script can be writing in a way when they are transparent, readable and manageable. No less so then Python scripts which 
typically suffer from the abuse of OO. The pervert trend of some Perl guru to push to the limit expressiveness of Perl and used 
difficult to comprehend idioms should be resisted.  Actually if you look at Larry Wall early scripts in Perl 4 he also abused 
this capability of the language, but he can be excused as a designed of the language. But people like
<span class="module__title__link">Randal L. Schwartz who make the abuse of language expressiveness a semi-legitimate "Perl Guru" 
style</span> which gave Perl a bad name should be condemned and never followed.  Here I am reminded Talleyrand advice to young 
diplomats "First and foremost not too much zeal". </p>

<p>This is a very limited effort to help Unix sysadmins to learn of Perl. It is based on my FDU lectures to CS students.   See also my ebook <a target="_blank" href="Perlbook/index.shtml"><b>Introduction to Perl for Unix system administrators</b></a> 
It discuss an approach to programming known as "defensive programming" and limits  exposure of Perl to a subset of Perl which can be called "<tt>Minimal Perl</tt>". 
Which is only logical as this site explicitly condemns and tries to counter "excessive complexity" drive that dominates many 
Perl-related sites and publications.  </p>

<p>For sysadmins <span class="a-size-base review-text" data-hook="review-body">Perl 
hits a "sweet spot": (a) it is available on for all Linux distributions (it is important as often in large corporate 
environment installation of additional languages is prohibited by the security department); (b) it integrates very well (I would say 
amazingly well)  in the shell environment; (c) it easily 
replaces multiple utilities (sed, awk, bash for longer scripts, etc.) and is uniform between different flavors of Unix solution; (d)  
there are modules to interact with the entire application stack including databases. </span> </p>

<p>One important advantage of Perl over Python is that is very close to shell and programming skills for shell can be reused in 
Perl; no so much in Python which stems from European school of language and compliers represented by Nicklaus Wirth.   Also Perl also 
significantly faster then Python, which carry the burden of object orientation even to single variables (creating for each of them 
something like inode) although on modern CPUs and for the tasks of writing utilities this is critical only for a few tasks (log 
processing tasks is one example).  </p>

<p>And if one think that Python is a "regular language" I can tell you that it is not. For example variables in Python are 
treated in 
C/Perl style -- assignment creates a copy of the variable. </p>
<pre>
a=3
b=a
a=5 # at this point b is still equal 3, like in Perl 
</pre>
<p>But for arrays and other "compound objects" this is not the case:</p>

<pre>alist = [25,50,75,100]
blist = alist # here Python copes the reference, not the array. so change arlist[0] actually changes blist[0] too</pre>

<p>The same is true about overall complexity of the language. The complexity of Python was just pushed into modules, it did not 
disappeared. And for example for string processing Python is more complex and less expressive language then Perl in which most text 
processing is done via regex engine.  For example, 
Python does not  have anything close in convenience to double quoted literals with interpolation until Python 3.6.  Only in Python 3.6+ you 
have something similar with f-strings:</p>
<pre>
#!/bin/env python3

job  = 'foo'
cpus = 3
print(f"job {job}")
print(f"cpus {cpus}")</pre>

<p>In older versions of Python you need to use C-style strings with % macros. And the best way to imitate Perl/shell double quoted 
string changes with each major version 
of Python (<a href="https://en.wikipedia.org/wiki/String_interpolation">String interpolation - Wikipedia</a>), which tell you something about 
consistency: </p>

<pre>
# in all versions
   apples = 4
   print("I have %d fruits" % apples)           # implementation via % operator; no longer recommended
   print("I have %(apples)d fruits" % apples )  # name of the variable is allowed; no longer recommended

# with Python 2.6+
   print("I have {0} fruits".format(apples))    # do now this is a method
   print("I have {a} fruits".format(a=apples))  # names instead of positional numerics

# with Python 2.7+
   print("I have {} fruits".format(apples))     # positional value now can be omitted</pre>

<pre>
# with Python 3.0+</pre>

<pre>
<span class="kn">    from</span> <span class="nn">string</span> <span class="k">import</span> <span class="n">Template</span>
   <span class="gp"> </span><span class="n">s</span> <span class="o">=</span> <span class="n">Template</span><span class="p">(</span><span class="s1">'</span>I have $frutno fruits<span class="s1">'</span><span class="p">)      # </span>The template object
<span class="n">    s</span><span class="o">.</span><span class="n">substitute</span><span class="p">(</span><span class="n">frutno=apples</span><span class="p">)                # actual substitution</span>

# or with Python 3.6+
   print(f"I have {apples} apples")             # radically new implementation based on f-string</pre>

<p>If you want interpolation in HERE strings in Perl you do not need to do anything special -- its automatic. But with Python only 
version 3.6+ has some analog called <a rel="noreferrer" href="https://www.python.org/dev/peps/pep-0498/#triple-quoted-f-strings">triple-quoted f-string</a>:</p>

<pre>
cpus = 3
job  = 'foo'
print(f'''\
job {job}
cpus {cpus}''')</pre>

<p>And if you you think that Python is logical original language superior to Perl I have a Brooklyn  bridge to sell to you. For 
example in Python search of the string can be performed with <tt>find</tt> method (C programmers and Perl users be  
damned): </p>

<pre>
message = "hello world"
pos = message.find("lo")
print(pos)</pre>
If the substring is not present, find returns a value of -1 like <tt>index</tt> function in Perl.  But the <tt>find() </tt>
method should be used only if you need to know the position of the substring. To check if substring is present in the string in  
conditional expression you need to use the <tt>in</tt> operator. And there is also<tt> index</tt> function in 
Python that behave differently, just to make 
C -programmers crazy ;-) It throws exception if the substring is not found.  This incompatibility suggests that Python designers have 
very little knowledge/respect of Unix and C when they started their project.

<p>Moreover, if one wants to to calculate the length of the string in Python, he/she needs to use <tt>len</tt> function, not <tt>
length</tt> method as one would expect. </p>
<pre>
message = "hello world"
mlen = len(message)</pre>

And such "non-uniformities" and special cases are all over Python language.  Also the mere number of methods provided in for 
each type is overwhelming in Python. For example there are 37 (thirty seven) string methods. Perl has just a dozen string functions. 
Everything else is done via regular expression. Strings in Python are immutable which create performance penalty. 
<h3><a name="Evolution_of_Perl">Evolution of Perl</a></h3>

<p>Despite the slide in popularity Perl experienced since 2000 Perl and severe lack of resources for the development of the 
language, Perl continues to evolve and improve. Thankfully it evolves slowly, but during the last decade we 
got <a href="Perlorama/Variables/state_variables.shtml">state variables</a> (5.10) and a couple of other useful features. Along with  
several useless features or features that  which many would consider redundant or even harmful and that should probably be 
removed from the language. The latter is due to the fact that after the create of the language steps down there is no high authority 
to "bless" changes for conceptual integrity. And petty people with high opinion about themselves and pretentions to become high 
priests of the community try to make their "scratch" by spoiling the language :-(.  This is a common, well known  problem 
with large open source project is which original developer stepped down and it is not limited to Perl. It is often described under 
the title "the loss of conceptual integrity" *the term introduced in the <i><a href="../Bookshelf/Computers/Classics/tmmm.shtml">The 
Mythical Man Month</a></i> by <a title="Fred Brooks" href="https://en.wikipedia.org/wiki/Fred_Brooks">Fred Brooks</a>. Different 
manifestation of the same are also known  <a href="https://en.wikipedia.org/wiki/Software_Peter_principle">Software Peter 
principle </a>,  <a href="https://en.wikipedia.org/wiki/Software_entropy">Software entropy </a> and 
<a href="../SE/featuritis.shtml">Featuritis</a></p>

<p>So far the evolution of Perl failed to resolve the most obvious problem with the language such as</p>
<ul>

   <li>Absence of the types of variable. this is probably was the most severe blunder in the original Perl design.  Even bash 
   now has variable types (and declare statement) . The idea of "flexible" types of variables proved to be a false start. In this 
   sense Python has more logical design: you still can change  the type of the variable, but  after you change it all 
   usage of variable should adhere to the same type -- no automatic conversion. .  </li>

   <li>Inherited from C problem with unintended usage of = instead of == in numeric comparison, or, worse, usage of == in string 
   comparisons.</li>

   <li>Inherited from Unix shell "type casting" of operators in comparison using two distinct sets of operators -- one for numeric 
   values and the other for strings.  </li>

   <li>Abuse of round brackets and the absence of "defense" against missing '}' (no local labels concept like in PL/1 where you can 
   close mulprle level of nesting by isung label suffix after the keyword end like end l3) </li>

   <li>Non uniform operations on arrays and strings (substr vs splice)  which make remembering two sets of operation more 
   difficult. </li>
</ul>

<p>Contrary to popular opinion the use of <a href="https://www.perl.com/article/on-sigils/">sigils</a> in Perl is more or less 
logical especially for scalar variables. Sigil $ denotes derefercing. It is also undeniable that string interpolation inside double 
quoted string is easier with sigils. Moreover sigils also clearly demarcate variables from built-in functions and subroutines  
making wting syncax coloring in editors easier.  So this particular decision withstand the test of the time. </p>

<p>Contrary to popular opinion, syntax of Perl 5 is pretty regular, and closely adheres to traditional C-style syntax which makes it 
easy to learn for both sysadmin coming from BASH or ksh and C or C++ programmers coming from respective language.  It can favorably compared with the disaster which is syntax of Borne shell. </p>

<p>Actually it does not  look too bad in comparison with Python which has syntax rules which are much farther from C and 
Unix. Python creates severe cognitive dissonance for people who program in C or C++. Especially with some decisions like usage of whitespace to 
determine the nesting. This decision  has serious negative effects for long 
multipage loops and other control constructs, forcing to make them shorter.   Not that C-style solution used in Perl is perfect (runaway unclosed '{' bracket is a huge problem 
with this notation), but at least it is uniform with C and C++, which is important. People who spend many years programming C or C++ have their own methods to compensate for the deficiency of this notation and 
accumulate tremendous skills of reading it and using it large programs. Experience that 
Python just sends to the dust bin. </p>

<p>Somehow due to his natural talent (he was never trained as a compiler writer and does not have CS degree) Larry Wall managed to avoid most classic pitfalls in creating of the syntax of the language, 
pitfalls in which creators on PHP readily fell ("dangling else" in PHP is one example) and from which Python suffers as 
well. </p>

<p>Just as a side note Python inherits from C usage of <tt>=</tt> for assignment and <tt>== </tt>for comparison, the blunder that has very serious 
consciences as for the amount of errors both in C and Perl. In Python assignment is invalid in conditional expressions, which makes 
it safer and eliminates this type of errors, but at the same time losing expressive power and making programs more verbose:</p>

<pre>
   if a=1 : print a
        ^
SyntaxError: invalid syntax
</pre>

<h3><a name="Perl_debugger">Perl debugger is one of better kept secrets of the language. It is an amazingly powerful tool </a> </h3>

<p>One of Perl’s better-kept secrets is its built-in debugger that allows developers to test their programs with ease and to 
rapidly track down errors in their Perl scripts. Python only recently got a semi-decent debugger. Before that the language sucked 
badly. PHP is another similar sicker. Actually for qualified programmer the quality of the debugger is as important if not more 
important then the quality of the language. In this area Perl really shines as it has powerful debugger as long as I remember (it did have it 
in 1994 when I started to use it) </p>

<p>This is a very powerful tool that unfortunately few Perl programmers (and even 
fewer sysadmins)  know well. It allows to 
create debugging scripts, create you own set of aliases for each program you debug, as well as remote debugging.  I view it a 
crown jewel of the Perl language environment.</p>

<p>While number of IDE that Perl has is less then Python you can use free Komodo editor 
(somewhat buggy and idiosyncratic, but OK) or  <a href="Pythonorama/Programming_environment/IDEs/pycharm.shtml">pycharm</a>  which does not advertize 
its support of Perl but does it really well (and it has a free version for individual developers).  Eclipse has Perl plug-in as 
well.  all of them integrates with  Perl debugger. </p>

<p>I think the second book about the language you should read should be a book about Perl debugger (see below) </p>


<!---google box ------->
<table border="0" width="310" align="left" cellspacing="7" cellpadding="4">
<tr><td width="340" bgcolor="#FFFF00" valign="center" align="center">
<center>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Top Large Rectangle -->
<ins class="adsbygoogle"
     style="display:inline-block;width:336px;height:280px"
     data-ad-client="ca-pub-4031247137266443"
     data-ad-slot="3274064497"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>
</td></tr>
</table>
<!---end of google box -------> 

<h3><a name="Perl_is_installed_by_default">Perl is installed by default in all flavors of Linux and all other enterprise flavors of 
Unix (Solaris, HP-UX and AIX)</a></h3>

<p>While Python is not installed by default in all major Linux distributions  too, this is not true for AIX, Solaris and HP-US.  
And in highly secure environment you are prohibited installing such huge packages without jumping via so many bureaucratic hoops 
that you regret that you started this adventure. </p>

<p>Systems administrators need to deal with many repetitive tasks in a very complex, and changing environment which often includes several 
different flavors of Linux (RHEL and Suse) and Unix (Solaris, HP-UX and AIX). Linux has Perl installed by  default.  It is 
also included in all major Unix flavors but version installed might be outdated and need upgrading. For example Oracle installs Perl too, so it 
is automatically present on all servers with Oracle database.  Some other application install Perl too.  That means that it provides 
the simplest way to automate recurring tasks on multiple platforms. Among typical tasks which sysadmin need to deal with: </p>
<ul>

   <li>

   <b>Analyze log files. </b>You can achieve high quality only by writing your own or customizing somebody else
   <a href="../Logs/Log_analysers/logwatch.shtml">log analyzer</a>.  Using default (for RHEL it is Logwatch) might not be all that 
   good as often you need to pay attention to specific combination of messages and that requires some programming.  Modern computers 
   allow processing logs in memory, so multipass processing is not a problem.  Some people successfully adapted spam engines 
   written in Perl for 
   log processing. 
   </li>

   <li>

   <b>Monitor filesystems, processes and networking. </b>The most common and unfortunately poorly understood task is modifying free 
   disk space.  Theoretically this should be included in Linux, but it is not.  so postprocessing <tt>df </tt>output is the 
   most common way to do it. Many Perl scripts exists and can be adapted to the task (often within some monitoring framework, for example
   <a href="../Admin/Monitoring/mon.shtml">mon</a>) 
   </li>

   <li>

   Install software, applying patches to OS and application. Upgrade applications and sometimes OS to new version.  the problem 
   with Linux is libraries hell and here custom scripts can help. 
   </li>

   <li>

   <b>Manage user accounts.</b> This is dull and unrewarding task if you do it manually on multiple servers. Tere are most often 
   specific requrements for creation of accounts that can be scripting (for example, the selection of UID and GID as well as usage of 
   <a href="../Access_control/Groups/user_private_groups.shtml">User Private Groups</a> )</li>

   <li>

   <b>Work with configuration files, including files in complex formats such as HTML and XML</b>  You often can do better by 
   generating those files from scripts them managing them as text files.  The classic example here is the /etc/hosts file and  
   /etc/group file</li>

   <li>

   <b>Administer databases and webserver (often with LAMP installation), </b>as in small companies there is no specialized personnel 
   for those tasks. If you are make responsible for webserver, or wiki engine that adds to your sysadmin responsibilities and without 
   "helper" scripts you might be overworked and underpaid.  
   </li>

   <li>

   Work with directory services like LDAP and Active Directory</li>

   <li>

   <b>Administer services like NTP, SMTP, DNS and DHCP. </b>Often you need to process email logs and spam engine logs for quality 
   control. 
   </li>

   <li>

   <b>Maintaining and enhancing server security. Often searching for a signs of intrusion requres creation of modification of existing 
   scripts.</b> Also if you understand and can modify your hardening scripts in most cases you are better off then sysadmin who applies 
   them blindly and faces consequences ;-) 
   </li>
</ul>

<p>You definitely can greatly simplify your life as well as improve "manageability" of the servers (or group of servers) with additional 
Perl scripts, some written by use, some borrowed and adapted to your environment.  As long  as you still apply KISS principle 
and do not try to overload those scripts with "features".  Because at some point the task of maintaining the scripts became evident 
and unless scripts are simple the game might not worth the candles.   that's the gotchas, which catches many  
sysadmin  who overreached  and added too much complexity to their scripts.  The slogan KISS can be in this contest 
mean: keep it simple sysadmin. </p>

<p>As most sysadmins already know shell, the affinity with shell is one of the major advantages of using Perl as the second scripting 
language for Unix sysadmin. no other language come close in this respect: Perl allow to reuse most of the key concepts of the shell.
</p>

<h3><a name="What_Softpanorama_can_offer_people_who_want_to_learn_Perl">What Softpanorama can offer to sysadmins who want to learn Perl</a></h3>

<p>IMHO the main advantage of using powerful complex language like Perl is the ability to write simple programs which in the past 
required for sysadmin to use several languages (bash+AWK+SED). It also was created without OO which later was "bolted on". And I 
consider this a very important advantage for sysadmin domain of utilities. Perhaps the world has 
gone overboard on this object-oriented thing.  I do not see much use of it for utilities space -- they add nothing and the 
attempt to structure utilities in OO fashion typically backfires and leads to excessive complexity and bloat. Often it leads to the creating what is 
called "<a href="https://www.youtube.com/watch?v=XrIjEponeeU">object oriented spaghetti</a>". </p>

<p>At the same time Perl is surprisingly high level language and for writing sysadmin utilities is has higher level then Python. You do not need many tricks used in lower level languages as Perl itself provides you 
high level primitives for the task. </p>

<p>This page is linked to several sub-pages in the top "contents" table. The most important among them are: </p>
<ul>

   <li>

   <b><a target="_blank" href="Perlorama/perl_language.shtml">Perl Language</a> -- </b>assorted language issues and programming tricks</li>

   <li>

   <a target="_blank" href="Perlorama/applications.shtml"><b>Perl a</b></a><b><a target="_blank" href="Perlorama/applications.shtml">pplications</a>
   </b>page where I collected links to Perl module for many interesting application area. Please note that it has a companion page Perl 
   development tools. 
   </li>

   <li>

   <a target="_blank" href="Perlorama/perl_programming_environment.shtml"><b>Perl programming environment</b></a><b> page</b>, that 
   might be useful for finding links related to some tools and difficult to understand areas (namespaces). 
   </li>

   <li>

   <b><a target="_blank" href="../People/Wall/index.html">Larry Wall</a> </b>biography.<b> </b>
   </li>

   <li>

   <b><a target="_blank" href="Perlorama/history_and_philosophy.shtml">History and philosophy</a></b></li>

   <li>

   <a target="_blank" href="Perlorama/articles.shtml"><b>Recommended Papers</b></a></li>

   <li>

   <b><a target="_blank" href="../Bookshelf/Computers/perl.shtml">Recommended Books</a></b></li>

   <li>

   <b><a href="Perlorama/perl_in_command_line.shtml">Perl as a command line tool</a></b></li>
</ul>

<p>All language have quirks, and all inflict a lot of pain before one can adapt to them. Once learned the quirks become incorporated 
into your understanding of the language. But there is no royal way to mastering the language. The more different is one's background 
is, more one needs to suffer. Generally any user of a new programming language needs to suffer a lot ;-)</p>

<h3><a name="Adapting_to_the_language_quirks_and_warts">Adapting to the language quirks and warts</a></h3>

<p>When mastering a new language first you face a level of "cognitive overload" until the quirks of the language become easily handled 
by your unconscious mind. At that point, all of the sudden the quirky interaction becomes a "standard" way of performing the task. For 
example, regular expression syntax seems to be a weird base for serious programs, fraught with pitfalls, a big semantic mess as a result 
of outgrowing its primary purpose. On the other hand, in skilled hands this is a very powerful tool that can serve a reliable parser 
for complex data and in certain cases as a substitute for string functions such as <tt>index</tt> and <tt>substr</tt>. </p>

<p>There are several notable steps in adaptation to Perl idiosyncrasies for programmers who got used to other languages: </p>
<ol>

   <li><b>Missing semicolon at the end of statement.</b> This is a typical problem for all languages that delimit statements with 
   the semicolon. There is something unnatural to humans in this arrangement. It looks to me that Fortran approach (statements ends 
   at the end of the line unless the line contains  \ at the end is a better deal.  IBM PL/1 debugging  complier  
   designers (one of greatest teams ever to design compilers)  implemented the idea of "soft semi-colon" -- if the insertion of 
   semicolon allow to continue parsing then correct  this error and inform the user. But this was during the day of batch 
   compliers and this approach has its own  drawbacks, as it can introduce errors to the program due to automatic correction.
   <br>
   <br>
   The problem is that this error is persistent and continue to occur for highly qualified users of Perl with amazing and consistent 
   regularity. Multiple years of using the language under the belt does not help.  One way to lessen this problem is to check 
   for it before you submit  the script to the interpret.  Prettyprinter can label such line  too if you have your 
   custom Prettyprinter (<a href="../Utilities/Beautifiers/neatperl.shtml">I have</a>) <br>
 </li>

   <li><b>Forgetting to put $ in front of scalar variable. This problem is aggravated if you use several language with the other 
   that does not require this prefix. </b>One early sign is when you start to put $ on all scalar variables automatically.  C 
   programmer can think about $ as as a dereferencing operator to the pointer to the value of the variable. So if <tt>line</tt> is 
   as pointer, then <tt>$line</tt> is the value of the variable referenced by this pointer.  and <tt>$$line</tt> is the second 
   level dereferencing. 

   <p>That's easy for those people 
   who use write their own shell scripts and generally is not a problem for sysadmins.<b> </b>Most mistakes when you omit $ in front of 
   the variable are diagnosed by interpreter, but some cases like <tt>$location{city}</tt> are not. The problems arise if  along with 
   Unix shell you use the third language, for example C.  In this case you automatically makes make mistakes, despite your experience, and you need conscious 
   effort to avoid them all the time. This is the case with me. <br>
 </li>

   <li>U<b>sing two different comparison operations, one for strings and the 
   other for numerical values</b> (<tt>"=="</tt> for numbers vs. <tt>eq</tt> for strings) <b>for comparison numbers and strings.</b>  
   This is design blunder Perl inherited from Unix shell.  That also makes operation "typed", which is an interesting, but very 
   questionable approach inhereted by Perl from Shell. The problm is that the game is not worth candles -- practice convincingly had 
   shown that this adds very little to the language power and expressivness,  but introduces nasty bugs and it is better to 
   allow only explicit type conversions.  
   In case a constant is involved ( like <tt>$line == 'EOF'</tt> ) Perl provides warnings, but if two variables are involved, the interpreter does not provide any warnings, so you need to be very careful. 
   
   <p>Especially if you use other 
   language in parallel with Perl<em>. In this case such errors crop into your scripts automatically</em>. Only if one of the operators of "<tt>==</tt>" 
   is a string constant, meaningful automatic diagnostic can be provided. <br>
 </li>

   <li><b>Use of "<tt>=</tt>" as equality predicate for numbers instead of<tt> ==. </tt> </b><tt> I</tt>f you use and 
   C-style which uses "<tt>=</tt>" 
   for assignments you are in trouble: you can easy make an error using it instead of == in conditional. Please note that Algol60 
   avoided this by using := for assignment, so even early languages recognized this problem., So in away this can be viewed as a 
   blunder in C-language design (or more correctly in PL/1 language design as C for all practical purposes is just a subset of PL/1 
   with pointers; and it was designed as such (PL/1 was system programming language for Multics what was the major school of 
   programming for Thomson and Richie)  <br>
   <br>
   The pitfall of using "=" for assignment,  results in the side effect of introducing errors 
   in comparisons in Perl, as you put "=" instead of "<tt>==</tt>".  For example,   <tt> if ($a=1)...</tt>  instead 
   of if  <tt>($a==1)... </tt>This problem was understood by designers on Algol 60 ( To avoid it they used <tt>:=</tt> 
   for assignment instead of plain <tt>=)</tt>, which was designed is late 50th. But Perl designers followed C designers (which make 
   this blunder, along with several other in designing C)  and naturally stepped on this rake again. With predictable result. Actually the designers of Fortran, PL/1, C (as derivative of PL/1), C++ and Java 
   ignored this lesson (Fortran designers are actually not guilty as it predates Algol 60). But  because C  (with its derivatives 
   such as C++ and Java) became dominant programming language we have, what we have: propagation of this blunder to many top programming 
   languages. Now think a little, about the notion of progress in programming language design ;-)  It's sad that the design blunder 
   about which designers knew 65 years ago still is present in the most popular languages used today ;-). In all languages that have 
   lexical structure of C, this blunder remains one of the most rich source of subtle errors for novices. Naturally this list includes 
   Perl. C programmers typically are already trained to be aware about  this language pitfall. But in Perl you too can use several 
   protective measures<ol>

      <li>Modify syntax highlighting in your editor  <em>so that such cases were marked in bold red. </em></li>

      <li>Manually or automatically (simple regex done in the editor can detected ~ 99% of cases) reorganize such comparisons </li>

      <li>Put 
      the constant on the left part of comparison, like in  <tt>if (1==$a)....</tt></li>

      <li>Recent versions of Perl interpreter provide warning in this case, so checking your script with option <tt>-cw</tt>  or 
      better using <tt>use warnings</tt>  pragma in all your scripts. It also helps if IDE provides capability to display of results 
      of checking of syntax in one of the windows and jump to the line in code listed in the error or warning (this is a standard feature 
      of all IDEs and actually this can be done in most editors too).  </li>
   </ol>
   </li>

   <li><b>Missing closing "}" problem . </b>This problem is typical for all C-style languages and generally requires pretty 
   printer to spot.  But Perl interpreter has a blunder -- it does not recognize the fact that in <em>Perl subroutines can't be nested 
   within blocks </em>and does not point to the first subroutine as the diagnostic point -- it points to the end of the script.  
   Usually you need a Prettyprinter to spot this error. In you do notr have one and do not  want to get one and learn to use it 
   (big mistake) one of 
   the best way to find exact point of this error is to extract suspicious section into a new file and check it separately, cutting not relevant parts, until you detect 
   the problem. The longer the program is the more acute this problem becomes. BTW this problem was elegantly solved in PL/1 which was created 
   in early 60th: PL/1 has labels for closing statements as in "<tt>mainloop: do... end mainloop</tt>" which close all intermediate 
   constructs automatically. Both C and Perl failed to adopt this innovation.  Neither Perl not C also use the concept of Pascal 
   "local numeric labels"  -- labels that exist only until they are redefined, see discussion at Knuth. 


<p>I would way that the lack of build-in Prettyprinter in Perl is a blunder of the designers of Perl interpreter. It is 
understandable as Perl never enjoyed sizable material support from big corporations, but still... <br>
 </p>
 

   <li><b>Missing round brackets  or unbalanced round brackets  in control statements like if, while, etc .</b> Like "missing ';' " problem this error is persistent and does not 
   evaporates with the increate of your Perl skills. Looks like this is a design flow of the language and you need to check you 
   scripts for this particular error manually. Good Prettyprinter can point most of those errors because  they are more local 
   than missing "}" error. <br>
 </li>

   <li><b>Missing</b> " <b>(double quote)</b> or ' <b>(single quote) problem</b>.  With good editor this is not a problem 
   as syntax highlighting points you where the problem begins.  Perl has pragma of specified max constant length, which is one 
   way to improve quality of detection of this error. You can also implement  program (one line sting literals only) in the 
   interpreter, because multiline strings pretty rate in real programs.  To put multilateral string you can need to disable 
   this pragma for the  fragment of the script where it is located. </li>

   <li> <b>Typos in variables which creates variables used only once.</b>  You can block this  error now with strict 
   pragma, so it is less important unless yyou need to maintain huge legacy scripts.  Also Perl interpreter provides warnings 
   for all such cases.  Looks like that requrement to declare all variables before use is a sound programming language design 
   practice.  The gains from contextual  typing of variables (introduced BTW in Fortran)  do not compensate the 
   damage from such an error. </li>
</ol>

<p>Please note that as syntax of Perl is complex. So the diagnostic in Perl interpreter is really bad and often point to the spot far 
below where the error occurred.  It is nowhere near the quality of diagnostics that mainframe programmers got in IBM PL/1 diagnostic 
complier, which is also probably 50 years old and run on tiny by today standard machines with 256K (kilobytes, not megabytes)  
of RAM and 7M (megabytes, not gigabytes, or terabytes) harddrives.  The only comfort  is that other scripting languages are 
even worse then Perl ;-). </p>

<h3><a name="Benefits_that_Perl_brings_to_system_administration">Benefits that Perl brings to system administration</a>  </h3>

<p>All-in-all Perl is the language that fits most sysadmin needs, It' not fancy and its general usage is in decline since 2000 but fashion 
should never be primary factor in choosing the scripting language. Perl has stable and well tested  interpreter and is close to 
shell (to the extent  that most concepts of shell can be directly reused). And that's what important. As on modern servers Perl 
interpreter loads in a fraction of a second, Perl also allows to get rid of most usage of AWK and SED, making you environment more uniform 
and less complex. This is an important advantage.  Among benefits that Perl bring to system administration are</p>
<ul>

   <li><b>Extremely good integration with Unix.</b> Most system calls are directly available from Perl much like in C. </li>

   <li><b>Set of very useful for sysadmin modules such as</b> <a target="_blank" href="http://search.cpan.org/~rgiersig/Expect-1.15/Expect.pod"><tt>
   expect.pm</tt></a> </li>

   <li><b>Extremely good debugger.  </b>Which is a half of language value. </li>

   <li><b>Unix flavor independence.</b> Perl is installed by default on each and every enterprise flavor of Unix </li>

   <li><b>High level of commonality with shell and AWK, </b>which are common languages for each sysadmin.  That permit reuse of 
   skills and simplifies learning. </li>

   <li><b>An excellent set of printed books, eBooks and articles, from beginner to expert </b></li>

   <li><b>Huge centralized repository of code and modules </b>(CPAN) </li>

   <li><b>Good set of development tools,</b>  support of code coloring in all major editors, automated code formatting and pretty-printing 
   (<tt>perltidy</tt>)</li>

   <li><b>Build-in "self-documenting" system (POD)</b>  which allow you to practice "<a href="../SE/literate_programming.shtml">literate 
   programming</a>" if you are inclined to do so. </li>

   <li><b>Elegant testing environment</b> (<tt>Test::More</tt> etc) </li>

   <li><b>Perl can use huge amounts of memory</b> so even it can process very large file such as web logs in memory. </li>
</ul>

<p>In short if make sense to learn Perl as it makes sysadmin like a lot easier. Probably more so then any other tool in sysadmin arsenal...
</p>

<p>Perl is really great for text processing and in this particular domain is probably unmatched. For example in Python regular expressions 
are implemented via standard library module; they are not even a part of the language.</p>

<h3><a name="A_warning_about_relative_popularity">A warning about relative popularity</a></h3>

<p><span class="rendered_qtext"> </span>As of 2017 Perl no longer belongs to the top 10 programming languages (<a target="_blank" href="https://www.infoworld.com/article/3237085/javascript/scripting-languages-slip-in-popularity.html">Scripting 
languages slip in popularity, except JavaScript and Python</a>, Infoworld,
Nov 13, 2017).  It's still more popular 
then Visual Basic, so there nothing to worry about.  But far less then popular then Python. <span class="rendered_qtext"> Of 
cause popularity is not everything. Python and Perl share some characteristics, but don't exactly occupy the same niches. But it is 
a lot:</span> fashion rules the programming, so this is a factor that you need consciously evaluate and be aware of. </p>

<p>In 
large enterprise environment, outside system administration area Perl now is almost invisible. Python is gaining ground in research. 
Mostly because 
universities both in the USA and Europe now teach Python in introductory classes and engineers come "knowing some Python". This looks like 
"Java success story" of late 1990th on new level. Like Perl, Python is also now installed on all Linux distributions by default and 
there are several important linux system programs written in Python (yum, Anaconda, etc) which implicitly suggest that Python has Red 
Hat mark of adoption/approval too (yum was originally written at Duke University Department of Physics) </p>

<p>So there is now a pressure to adopt Python. That's sad, because IMHO Perl is a great scripting language which can be used on many different levels, starting from AWK/SED replacement 
tool (this especially make sence if you use different platforms. for example
<span class="a-size-base review-text" data-hook="review-body">their behavior differs between Mac OS X and Linux. But PERL is the 
same in both those environments.</span><span data-hook="review-body">).</span> <span class="rendered_qtext">Going from Perl to Python for text processing to me feels like leaving a Corvette and driving a 
station wagon. Python will gets you there. But it's not fun and will take more time although you probably might feel more 
comfortable inside. </span> </p>

<p>Here is an insightful post on this topic (<a target="_blank" href="https://www.quora.com/Which-is-better-Perl-or-Python-Which-one-is-more-robust-How-do-they-compare-with-each-other">Which 
   is better, Perl or Python Which one is more robust How do they compare with each other</a>):</p>
<blockquote>

   <b><a target="_blank" href="https://www.quora.com/profile/Joe-Pepersack">Joe Pepersack</a>,</b> 
                                                                        Just Another Perl Hacker<a target="_blank" href="https://www.quora.com/Which-is-better-Perl-or-Python-Which-one-is-more-robust-How-do-they-compare-with-each-other/answer/Joe-Pepersack"> Answered
                                                                           May 30 
                                                                           2015</a><blockquote>
      
                                                                        <p>Perl is better. Perl has almost no constraints.  
                                                            It's philosophy is that there is more than one way to do it (TIMTOWTDI, 
                                                            pronounced Tim Toady). Python artificially restricts what you can do as 
                                                            a programmer.  It's philosophy is that there should be one way to do 
                                                            it.   If you don't agree with Guido's way of doing it, you're 
                                                            sh*t out of luck.</p>

                                                                        <p>Basically, Python is Perl with training wheels.   
                                                            Training wheels are a great thing for a beginner, but eventually you should 
                                                            outgrow them.  Yes, riding without training wheels is less safe.   
                                                            You can wreck and make a bloody mess of yourself.   But you can 
                                                            also do things that you can't do if you have training wheels.   
                                                            You can go faster and do interesting and useful tricks that aren't possible 
                                                            otherwise. Perl gives you great power, but with great power comes great 
                                                            responsibility.</p>

                                                                        <p>A big thing that Pythonistas tout as their superiority is that Python 
                                                            forces you to write clean code.   That's true, it does... at the 
                                                            point of a gun, sometimes at the detriment of simplicity or brevity.   
                                                            Perl merely gives you the tools to write clean code (perltidy, perlcritic, 
                                                            use strict, /x option for commenting regexes) and gently encourages you 
                                                            to use them.</p>

                                                                        <p>Perl gives you more than enough rope to hang yourself (and not just rope, 
                                                            Perl gives you bungee cords, wire, chain, string, and just about any other 
                                                            thing you can possibly hang yourself with).   This can be a problem.   
                                                            Python was a reaction to this, and their idea of "solving" the problem was 
                                                            to only give you one piece of rope and make it so short you can't possibly 
                                                            hurt yourself with it.    If you want to tie a bungee cord 
                                                            around your waist and jump off a bridge, Python says "no way, bungee cords 
                                                            aren't allowed".  Perl says "Here you go, hope you know what you are 
                                                            doing... and by the way here are some things that you can optionally use 
                                                            if you want to be safer"</p>

                                                                        <p><b>Some clear advantage of Perl:</b></p>
                                                                        <ul>

                                                                           <li>
                                                                           <a target="_blank" href="http://moose.iinteractive.com/en/">Moose: postmodern object system for Perl</a>.   Declarative 
                                                               programming FTW.</li>

                                                                           <li><b>One liners</b>.   Perl has a whole set of shortcuts 
                                                               for making it easy to write ad-hoc scripts on the command line</li>

                                                                           <li><b>Speed.</b>  For most tasks, Perl is significantly faster 
                                                               than Python</li>

                                                                           <li><b>Regular expressions are a first-class datatype rather than an 
                                                               add in</b>.  This means you can manipulate them programatically 
                                                               like any other first-class object.</li>

                                                                           <li><b>Power.</b>   You can do things in Perl that are either 
                                                               much harder, or prohibited, in Python.   For instance the <> 
                                                               operator... this lets you trivially deal with the complexities of opening 
                                                               files from the command line and/or accepting streams from pipes or redirection.  
                                                               You have to write several lines of boilerplate Python code to duplicate 
                                                               the behavior of Perl's 
                                                                           <code class="prettyprint inline prettyprinted">while <b>(<>) { ... }</b></code><b> construct (or even more trivially 
                                                               the -n switch, which automatically wraps your code with this construct).</b></li>

                                                                           <li><b>No significant whitespace.</b>  If your formatting gets mangled 
                                                               (by, say, posting it to a web forum or sending it in an email that munges 
                                                               whitespace), the meaning of your code doesn't change, and you can trivially 
                                                               re-format your code with 
                                                                           <a target="_blank" href="http://perltidy.sourceforge.net/">Perltidy</a> according to whatever coding style you define. You 
                                                               can format your code as to what is most clear in context, rather than 
                                                               having to conform to an arbitrary set of restrictions.</li>

                                                                           <li><b>Postfix notation.</b>  This can be ugly and is easily misused, 
                                                               but used with care it makes your code easier to read, especially for 
                                                               things like <code class="prettyprint inline prettyprinted">die if $condition</code> 
                                                               or <code class="prettyprint inline prettyprinted">die unless $condition</code> 
                                                               assertions.</li>

                                                                           <li><b>Sigils</b>.  It's a love it or hate it thing, but sigils 
                                                               unambiguously distinguish variables from commands, make interpolation 
                                                               effortless, and make it easy to tell at a glance what kind of variable 
                                                               it is without having to resort to some ugly hack like Hungarian notation.</li>

                                                                           <li>
                                                                           <a target="_blank" href="http://search.cpan.org/~ingy/Inline-C-0.75/lib/Inline/C.pod">
                                                                           <b>Inline::C</b> </a>and all of the other Inline::* modules).   
                                                               Yes, you can write Python extensions in C but Inline::C makes it effortless.</li>

                                                                           <li><b>Pod is vastly more powerful than Docstrings,</b> especially when 
                                                               you throw in the power of something like
                                                                           <a target="_blank" href="http://search.cpan.org/~rjbs/Pod-Weaver-4.012/lib/Pod/Weaver.pm">Pod::Weaver</a> to write/manipulate your documentation 
                                                                           programmatically.</li>
                                                                        </ul><b>Advantages of Python</b><ul>

                                                                           <li><b>JVM interoperatiblity. </b>  For me this is huge.  It's 
                                                               the only thing that Python does better than Perl.   Being able 
                                                               to write code that runs in the JVM and to work with Java objects/APIs 
                                                               without having to write Java code is a huge win, and is pretty much the 
                                                               only reason I ever write anything in Python.</li>

                                                                           <li><b>Learning curve. </b> Python is easier to learn, no denying 
                                                               it.   That's why I'm teaching it to my 12 year old son as his 
                                                               first programming language</li>

                                                                           <li><b>User community</b>.  Python is more popular and has a larger 
                                                               active user community.   <em>Appeal to popularity is a fallacy, 
                                                               but you can't just dismiss mindshare and 3rd party support either.</em></li>
                                                                        </ul>
   </blockquote>
</blockquote>

<h3><span class="rendered_qtext">IDE that you can use with Perl</span></h3>

<p>Usage of IDE is a must in the current environment. Often sysdmins neglect this, but it does diminished their productivity. the 
key here is a powerful editor, built-in  remote debugger  while nice is not absolutely necessary. But ability to compare 
two versions, show usage of particular variable and prompt for the  write variable when writing statements are important. Show 
of nesting and pretty printing are also important but  can be done with the external tools.  Also important is the  
ability to work with data-space (renaming varibale in files for the whole project, etc). Perl does not even ship with the "Standard IDE". 
But there are several usable options:
</p>
<ol>

   <li>Paradoxically GVIM is not that bad and can be installed both on Windows and Linux.  </li>

   <li>Padre, which is somewhat 
competitive with Komodo is available for free. The problem is that  but the latest binary distribution suitable for beginners is from 2012. It's still highly 
usable. </li>

   <li>Komodo Edit can serve as a surrogate IDE too. It is a decent editor and for Perl I would rate it slight higher then 
   Notepad++. It does a couple slick things: support macros and support syntax checking.   </li>

   <li><a href="Pythonorama/Programming_environment/IDEs/pycharm.shtml">pycharm</a> -- the most popular Python IDE can work with 
   Perl and works well. Attractive if you use some Python.   </li>

   <li>Eclipse via Perl plug-in. </li>

   <li>Visual Studio, if you already use it for other projects. 
   <a href="https://docs.microsoft.com/en-us/visualstudio/ide/adding-visual-studio-editor-support-for-other-languages">Adding Visual 
   Studio editor support for other languages Microsoft Docs</a> See also 
   <ul>

      <li><a href="https://www.nu42.com/2014/11/64-bit-perl-5201-with-visual-studio.html">64-bit Perl 5.20.1 with Visual Studio 2013 
      Community Edition on Windows 8.1</a></li>

      <li><a href="http://blogs.perl.org/users/andrew_shitov/2015/05/microsofs-visual-studio-code-editor.html">Microsof's Visual 
      Studio Code editor Andrew Shitov [blogs.perl.org]</a></li>

      <li>
      <a href="http://www.i-programmer.info/news/90-tools/8540-microsoft-releases-visual-studio-code-ide-for-linux-mac-and-windows.html">
      Microsoft Releases Visual Studio Code IDE For Linux, Mac And Windows</a></li>
   </ul>
   </li>
</ol>

<p>My feeling is that for Perl to remain competitive IDE should be maintained and shipped along with Perl interpreter (like in 
Python and R distributions).  May be at the expense of some esoteric modules included in standard  library.
</p>

<h3>Books to read</h3>

<p>Python now dominate books  on scripting languages and  number of books per year devoted to Python and available via Amazon for 2017 is at least one order of magnitude larger then the number 
of books devoted to Perl (quality issues aside). All this creates a real pressure to use Python everywhere, even in system administration.  
But first of all very few Python books  are good. Most do not explain the language well. And the second  is that you need 
just a couple of them not a dozen. So while on number front Perl definitely can't compete with Python several quality books (most 
not from O'Reilly) are available.  i would recommend (<b><a target="_blank" href="../Bookshelf/Computers/perl.shtml">Recommended Perl 
      Books</a>)</b></p>
<ul>

   <li>
   <a href="https://www.amazon.com/Debugging-Perl-Troubleshooting-Martin-Brown/dp/0072126760?SubscriptionId=AKIAILSHYYTFIVPWUY6Q&tag=duckduckgo-d-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=0072126760">
   Debugging Perl Troubleshooting for Programmers Martin C. Brown</a>. This an  old (2000),  but  still an excellent 
   book, which really provides overview of methods using which you can avoid most of typical errors.  You need this before you 
   meet the "real world". Especially if you need to support adapt somebody else scripts. </li>

   <li><a href="https://www.amazon.com/Minimal-Perl-Unix-Linux-People/dp/1932394508">Minimal Perl For Unix and Linux People Tim 
   Maher 9781932394504 Amazon.com Books</a></li>

   <li><a href="https://www.perl.org/books/beginning-perl/">Beginning Perl (free) - www.perl.org</a> by Simon Cozens. this free 
   books still beats many more recent books as for the coverage of the language. </li>

   <li>
   <a href="https://www.amazon.com/Effective-Perl-Programming-Idiomatic-Development/dp/0321496949/ref=sr_1_1?s=books&ie=UTF8&qid=1513723754&sr=1-1&keywords=Hall+Perl">
   Effective Perl Programming Ways to Write Better, More Idiomatic Perl (2nd Edition) (Effective Software Development Series) Jo</a></li>
</ul>

<h3><a name="The_most_common_versions_of_Perl__5_in_production">The most common versions of Perl  5 in production</a></h3>

<p>RHEL 6.x now ships with Perl 5.10. Many classic Unixes still ship with Perl 5.8.8. Older versions of  Solaris and HP-US servers 
might have version below Perl 5.8.8 but in 2017 that's rare as most of such servers are decommissioned (typical lifespan of a server 
in corporate environment is 5-7 years).  </p>

<p>It you need compatibility with all major flavor of Unix in you scripts it is a safe bet 
to write for Perl 5.8.8. Such a decision virtually guarantee compatibility with all enterprise servers, except those that should be 
discarded 5 or 10 years ago. In other words no "<a href="Perlorama/Variables/state_variables.shtml">state</a>" variables, if you want "perfect" compatibility. Non perfect, but acceptable.</p>

<p>If you need only 
Linux deployment compatibility that can be achieved by using version 5.10 which allow you to use "state" variables. </p>

<p>If you need compatibility with linux servers only version 5.10 look like a more or less safe bet too (very few enterprise servers 
in 2017 are now below version RHEL 6; those typically have Perl 5.8).  </p>

<p>Also too high version of Perl 5 is actually not desirable --  see <a href="#Problems_with_Perl_5._22">note about Perl 5.22</a>. 
(the current version of Perl 5 is version 30).  Hopefully warts added to version 22  will be corrected based on the feedback. 
Here is a slide from Oct 3, 2016 by Tom Radcliffe <a target="_blank" href="https://www.youtube.com/watch?v=mmG0LsS_eMY">The Perl Paradox</a> </p>
<center>
<img border="0" src="Perlorama/Images/versions_used.png" width="951" height="508"></center>

<h3><a name="The_problem_of_Perl_complexity_junkies">The problem of Perl complexity junkies</a></h3>

<p>There is a type of Perl books authors that enjoy the fact that Perl is complex non-orthogonal language and like to drive this notion 
to the extreme. I would call them <i>complexity junkies</i>. Be skeptical and do not take recommendations of Perl advocates like
<a href="../Bookshelf/Reviews/Computer_books_reviews/Learning_Perl_on_Win32.shtml">Randal L. Schwartz </a> or Tom Christiansen for granted :-) Fancy idioms 
are very bad for novices. Please remember about KISS principle and try to write simple Perl scripts without complex regular expressions 
and/or fancy idioms. <i><b>Some Perl gurus pathological preoccupation with idioms is definitely not healthy and is part of the problem, 
not a part of the solution... </b></i></p>

<p>We can defines three main types of <i>Perl complexity junkies</i>:</p>
<ul>

   <li><b>"Killing with obscurity" junkies.</b> A classic example of this approach is an article
   <a target="_blank" href="http://www.perl.com/pub/a/2005/06/16/iterators.html">Understanding and Using Iterators</a>. Actually Perl 
   has weak support of iterators as it lacks co-routine support. But you can never learn that from the paper where trivial example was 
   presented using obscure overcomplicated code that reminds me <a target="_blank" href="http://reality.sgi.com/csp/ioccc/">The International 
   Obfuscated C Code Contest</a>. This type of junkies is simply damaging. Please don't follow them. Try to write simple transparent 
   code. </li>

   <li><b>OO-enthusiasts flavor of Perl complexity junkies. </b>Here Damian Conway is a good example. Unlike real teachers that make 
   complex things simple, and complex thing possible, those Perl OO enthusiasts make simple things complex and complex things impossible.  
   Instead of advocating the real value of OO which is a <em>hierarchical segmentation of namespace</em> they concentrate their efforts 
   on trivia.  In no way their advice should not be taken at face value. OO has its place, especially when you are programming 
   GUI and Perl has pretty interesting "low level" OO mechanisms implementation that actually reveals the "kitchen" under OO. But their 
   relentless drive to convert Perl to OO religion has had effect:  usage without necessity. Generally Perl modules also provide 
   namespace separation and in most cases are enough.  Perl actually suffers from lower reliability as the result of conversion 
   of some Perl modules too OO paradigm.  Modules like <tt>Net::FTP</tt> after conversion to OO became too unreliable to be used 
   in production environment. </li>

   <li><b>Idiomatic Perl junkies.</b> Pathological preoccupation with idioms in Perl is far from innocent and far from healthy. Although 
   definitely gifted authors, <a href="../Bookshelf/Reviews/Computer_books_reviews/Learning_Perl_on_Win32.shtml">Randal L. Schwartz </a>and to lesser extent 
   Tom Christiansen are good examples of people too preoccupied with this fancy art. Fancy idioms are bad for novices and can contain 
   subtle limitations or side effects that can byte even seasoned Perl programmers. As somebody quipped <i>"My issues with Perl is when 
   people get <b>Overly Obfuscate</b>d with their code, because the person thinks that less characters and a few pointers makes the 
   code faster. "</i></li>
</ul>
<center>

<table border="2" width="80%" bgcolor="#FFFF00">
   <tr>
      <td>

      <p align="center"><b>My issues with Perl is when people get Overly Obfuscated with their code, <br>
      because the person thinks that 
      less characters and a few pointers makes the code faster</b><i>.</i></p>
      </td>
   </tr>
</table>

</center>

<p>Please remember about KISS principle and try to write simple Perl scripts without overly complex regular expressions or fancy idioms.  
If you do this Perl is great language, unmatched for sysadmin domain. Simplicity has great merits even if goes again current fancy.
</p>

<p>Generally the problems with OO mentioned above are more fundamental than the trivial "abstraction is the enemy of convenience". It 
is more like that badly chosen notational abstraction at one level can lead to an inhibition of innovative notational abstraction on 
others. In general OO is similar to idea of "compiler-copiler" when you create a new language in such a way that it allow to compile 
new constructs with the existing complier.  While in some cases useful or even indispensible, there is always a price to pay for 
such  fancy staff. </p>

<h2><a name="Tips">Tips</a></h2>

<h3><a name="Missing_semicolon_problem_in_Perl">Detecting  missing semicolon problem in Perl</a></h3>

<p>Some deficiencies of Perl syntax were directly inherited from C.  One of the most notable "obligatory semi-colon after ach statement. 
Which lead to tremendous  amount of errors. You can use "soft semicolon" approach (implied semicolon on line end if round brackets or similar symmetrical 
symbols are balanced) and put semicol on each line and then depete it on a fewline that do not need it</p>

<p>It is eady to implement using any editor maro (for example in vi) or as a mode of the pretty printer.  </p>

<p>Such an approach cuts number of iteration required to get rid of syntax errors by two or three. </p>

<h4 align="center"><a name="Avoiding_mistyping_=_instead_of_==_blunders">Avoiding mistyping "=" instead of "==" blunders 
by reversing comparison with the constant </a></h4>

<p>One of most famous C design blunder was the introduction of a small lexical difference between assignment and comparison (remember 
that Algol used <tt>:=</tt> for assignment; PL/1 uses = for both) caused by the design decision  to make the language more compact 
(terminals at this type were not very reliable and number of symbols typed matter greatly. In C assignment is allowed in if statement 
but no attempts were  made to make language more failsafe by avoiding possibility of mixing up  <tt>"="</tt> and <tt>"=="</tt>.  
In  C syntax <tt>if ($a = $b)</tt> assigns the contents of <tt>$b</tt> to a and executes the code following if <tt>b </tt>not equal 
to<tt> 0</tt>. It is easy to mix thing and write <tt>if ($a = $b )</tt> instead of <tt>(if ($a == $b)</tt>  which is a pretty nasty 
bug.  You can often reverse the sequence and put constant first like in </p>

<pre>if ( 1==$i ) ...</pre>
as

<pre>if ( 1=$i ) ...</pre>
does not make any sense, such a blunder will be detected on syntax level.

<h4 align="center"><a name="Locating_unbalanced_}__errors">Locating unbalanced "}"  errors using pretty printer</a></h4>

<p>This is the problem with all C-style language not only Perl. Ruby managed to avoid it switching to Algol-style delimiters, Typically this is connected with your recent changes so you should know where to look. Pretty printer (even simplistic
<a href="../Utilities/Beautifiers/neatperl.shtml">Neatperl</a>) allows instantly detent this type of errors </p>

<p>If you do not access to any pretty-printer (a very sad situation indeed) use diff with the last version that 
complied OK (I hope you use come kind of CMS like subversion or git)</p>

<center>
<table border="2" width="90%" bgcolor="#FFFF00">
   <tr>
      <td><b>The optimal way to spot missing '}' is to use pretty printer.  In the absence of pretty printer you can insert 
'}' in binary search fashion until you find the spot where it is missing. </b></td>
   </tr>
</table>
</center>

<p>You can also extract part of your script and analyze it separately, deleting "balanced" parts one by one.  This error actually discourages writing 
very long "monolithic" Perl scripts so the is a silver lining in each dark cloud. </p>

<p>You can also use pseudo comments that <em>signify nesting level zero </em>and check those points with special program or by writing 
an editor macro. One also can mark closing brackets with the name of construct it is closing </p>

<pre>if (... ) { 

} # if </pre>

<h4 align="center"><a name="Problem_of_unclosed_quote_at_the_end_of_the_line_string_literal__(...)_">Problem of unclosed quote at the 
end of the line string literal  ("...")</a></h4>

<p>Use a good editor.  moreover often you can split long literals into one line literals and concatenate them with dot operator. 
Perl process those at complite time so there is not run-time hit for using this (and  it should not be for any other language 
with a decent complier -- this complier optimization is classed constant folding and is a standard in modern compliers).  </p>

<p>As a historical note specifying max length of literals is an effecting way of catching missing quote that  was implemented in 
PL/1 compilers. You can also have an option to limit literal to a single line. In general multi-line literals should have different 
lexical markers (like "here" construct in shell). Perl provides the opportunity to use concatenation operator for splitting literals 
into multiple line, which are "merged" at compile time, so there is no performance penalty for this constructs. But there is no limit 
on the number of lines string literal can occupy so this does not help much. If such limit can be communicated via pragma statement 
at compile type in a particular fragment of text this is an effective way to avoid the problem. Usually only few places in program use 
multiline literals, if any.  Editors that use coloring help to detect unclosed literal problem but there are cases when they are 
useless. </p>

<h3><a name="How_to_avoid_using_wrong_comparison_operator_comparing_two_variable_">How to avoid using wrong comparison operator comparing 
two variable</a></h3>

<p>If you are comparing a variable and a constant Perl interpret can help you to detect this error. but if you are comparing two variable 
you are on your own. And I often use wrong comparison operator just out of inertia or after usage of C. the most typical for ma error 
is to use == for stings comparison. </p>

<p>One  way is to comment  sting comparisons and then match comments with the comparison operator used using simple macro 
in editor (you should use programmable editor, and vim is programmable) </p>

<p><b>Usage of different set of comparison operator for number and string comparison is probably the blunder in Perl design (which Python 
actually avoided) and was inherited from shell. </b>Programmer that use other languages along with Perl are in huge disadvantage her 
as other language experience force them to make the same errors again and again.  Even shell solution (using different enclosing 
brackets); it might well be that in Perl usage of  <tt>( ) </tt>for arithmetic comparison and <tt>((...))</tt> for string would 
be a better deal. They still can be used as a part of defensive programming so that you can spot inconsistencies easier</p>

<h3><a name="Perl_as_a_new_programming_paradigm">Perl as a new programming paradigm</a></h3>
<b>Perl + C</b> and, especially <b>Perl+Unix+shell</b> represent a  new programming paradigm in which the OS became a part of your 
programming toolkit and which is much more productive for large class of programs that  OO-style development (<a href="../SE/anti_oo.shtml">OO-cult</a> 
;-). It became especially convenient in virtual machine environment when application typically "owns" the machine. In this case the 
level of integration of the language and operating system became of paramount importance and Perl excels in this respect. You can use 
shell for file manipulation and pipelines, Perl for high-level data structure manipulation and C when Perl is insufficient or too slow. 
The latter question for complex programs is non-trivial and correct detection of bottlenecks needs careful measurements; generally Perl 
is fast enough for most system programs.
<br>
 <center>
<table border="2" width="90%" bgcolor="#FFFF00">
   <tr>
      <td><b>Exploiting high level of integration of Perl with shell and Linux is a new programming paradigm which became especially convenient in virtual machine environment when application typically "owns" the machine. In this case the level of integration of the language and operating system became of paramount importance and Perl excels in this respect. 
      In a way it is similar to LAMP paradigm. </b></td>
   </tr>
</table>
</center>

<p>The key idea here is that <em>any sufficiently flexible and programmable environment - and Perl is such an environment -- gradually 
begins to take on characteristics of both language and operating system as it grows.</em> See
<a target="_blank" href="http://steve-yegge.blogspot.com/2006/07/get-famous-by-not-programming.html">Stevey's Blog Rants Get Famous 
By Not Programming</a> for more about this effect.</p>
<center>

<table border="1" width="90%" bgcolor="#FFFF00">
   <tr>
      <td><b>Any sufficiently flexible and programmable environment - and Perl is such an environment -- gradually begins to take on 
      characteristics of both language and operating system as it grows.</b></td>
   </tr>
</table>

</center>

<p>Unix shell can actually provide a good "in the large" framework of complex programming system serving as a glue for the components.
</p>

<p>From the point of view of typical application-level programming Perl is very under appreciated and very little understood language. 
Almost nobody is interested in details of interpreter, where debugger is integrated with the language really brilliantly. Also namespaces 
in Perl and OO constructs are very unorthodox and very interesting design. </p>

<h3><a name="References_are_major_Perl_innovation">References are major Perl innovation</a></h3>

<p>References are Perl innovation: classic CS view is that scripting language should not contain references (OO languages operate with 
references but only implicitly). Role of list construct as implicit subroutine argument list is also implemented non trivially (elements 
are "by reference" not "by name") and against CS orthodoxy (which favors default "by name" passing of arguments). There are many other 
unique things about design of Perl. All-in-all for a professional like me, who used to write compilers,  Perl is one of the few 
relatively "new" languages that is not boring :-). </p>

<h3><a name="Perl_has_a_great_debugger">Never forget that Perl has a great debugger</a></h3>

<p>The quality of the debugger for the language is as important as the quality of language itself. Perl debugger is simply great. See
<a href="Perlorama/perl_debugging.shtml">Debugging Perl Scripts</a></p>

<h3><a name="Brilliance_of_Perl_Artistic_license">Brilliance of Perl Artistic license</a></h3>

<p>Perl license is a real brilliance. Incredible from my point of view feat taking into account when it was done. It provided peaceful 
co-existence with GPL which is no small feat ;-). Dual licensing was a neat, extremely elegant cultural hack to make Perl acceptable 
both to businesses and the FSF. </p>

<p>It's very sad that there no really good into for Perl written from the point of view of CS professional despite 100 or more books 
published. </p>

<h2><a name="Perl_warts">Perl warts</a></h2>

<table border="0" cellpadding="0" cellspacing="0" bordercolor="#111111" width="100%">
   <tr>
      <td width="33%"><br>
      </td>
      <td><b>A small, crocky feature that sticks out of an otherwise clean design. Something conspicuous for localized ugliness, especially 
      a special-case exception to a general rule. ...</b>

      <p align="right"><a target="_blank" href="http://www.tuxedo.org/~esr/jargon/">Jargon File's definition of the term "wart"</a>
      </p>
      </td>
   </tr>
</table>

<h3><a name="Language_design_warts">Language design warts</a></h3>

<p>Perl extended C-style syntax in innovative way. For example <em>if statement always uses {} block, never an individual statement</em>, 
also ; before } is optional. But it shares several C-style syntax shortcomings and introduced a couple of its own: </p>
<ul>

   <li><b>Lexical structure of the language is exceedingly complex and automatic type conversion is unnecessary, creates nasty 
   errors, and should probably be discouraged. You should always use <tt>strict</tt> mode to catch some errors 
   that escape interpreter on the stage of lexical and syntax analysis (</b><em>at least in the form</em><tt> strict 'subs'</tt><b>, 
   or better </b><tt>use strict; no strict "vars"; </tt><b>if you consider the requirement to declare all variables excessive and do 
   not want to use our to "import" global variables into local lexical scope). </b>Due to complexity of the lexical level of the language, 
   some errors are not located properly and are passed to the syntax level were they are not detected iether. For example if you accidentally 
   use <tt>$a==~/\d+/ </tt>  you will be surprised by the result

   <pre>
[0]  # perl -v

This is perl 5, version 26, subversion 1 (v5.26.1) built for i686-cygwin-threads-64int-multi
(with 7 registered patches, see perl -V for more detail)
... ... ... 
[0]  # cat lex_error.pl
#!/usr/bin/perl
# Error in lexical and/or syntax analysis phase of the interpreter (it does not detect ==~ as wrong operator)
 $a='2017';
 if ( $a ==~/\d/ ){
    print "String $a contains  digits\n";
 } else {
    print "String  $a does  not contains digits\n";
 }

[0]  # perl  lex_error.pl
<em>String  2017 does  not contain digits</em>
</pre>
   </li>

   <li><b>Usage of different set of comparison operator for number and string comparison is probably the most common source of difficult 
   to find bugs.</b> Programmer that use other languages along with Perl are in huge disadvantage her as other language experience force 
   them to make the same errors again and again.  Even shell solution (using different enclosing brackets); it might well be 
   better that 
   in Perl (aka usage of  <tt>( ) </tt>for arithmetic comparison and <tt>((...))</tt> for string). You need to use "<a href="../SE/defensive_programming.shtml">defensive programming</a>" 
   methods  so that you can spot inconsistencies easier</li>

   <li><b>Usage of obligatory semi-colon at the end of statement. </b>"<em>Flexible semi-colon</em>" concept (known from the days of 
   PL/ optimizing compiler) -- new line is equal to semicolon, if there is balance of round parenthesis or any other "symmetrical within 
   the statement" symbols) should be  a better deal.  One positive step in the right direction is that semicolon is optional 
   before "}". </li>

   <li><b>There is no explicit operator into cast variable into specific type</b>. While variable should be  typeless, the value 
   should be typed (like in Python; <tt>strict</tt> partially enforced this). For example such functions <tt>n( )</tt> and <tt>s( )</tt> 
   would help, although they can be imitated.</li>

   <li><b>There is no ability to close multiple open "{" to a given level. </b>For example<tt> "}...}"</tt> should close all nesting. 
   Subroutines should use different brackets of keyword like end so that nesting errors were detected earlier. If you missed closing 
   "}" finding that place is not trivial in a large script. Diagnostic is almost useless and only pretty printing can help. Also for 
   { and } iether local label like in assembler should be allowed or duplication of symbols (treated as a single symbol syntactically 
   but closing only identical number of closing brackets. . For example,
   <ul>

      <li><b>local labels (like in Pascal, they might be number -- that's enough): </b>
      <ul>

         <li><tt>{1{</tt> should be closed with <tt>}1}</tt> and <tt>{3{ </tt>with <tt>}3}</tt></li>

         <li>or some other  similar notation like <tt>{#1</tt> and <tt>}#1</tt>  </li>
      </ul>
      </li>

      <li><b>via symbol duplication:</b>  <tt>{{{ </tt> should be closed with <tt>}}}</tt> and <tt>{{</tt> with <tt>}}</tt>.  
      Such symbols also should close all unclosed intermediate brackets of the  same type. </li>
   </ul>
   </li>

   <li><b>Round brackets mismatch problem; usage of round brackets in </b><tt>if ( ) {...}</tt><b>  construct</b>.  In Perl 
   the logical expression is always terminated by opening curvy bracket "{".  Which is a good thing. But that means that those 
   round brackets <tt>if</tt> statement are essentially redundant and lead to numerous difficult to find mistakes (round brackets bracket 
   mismatch errors)  </li>

   <li><b>Usage of <tt>"="</tt> for assignment and "<tt>==</tt>" for equality is a huge design blunder inherited from C, which leads 
   to many nasty mistakes</b>. One defensive trick that helps to prevent those nasty errors is to write constants in comparisons on 
   the left side  (as in  <tt>if ( 5==$i ) {...</tt> }. This transformation can be done in pretty printer.  </li>

   <li><b>There is no way to limit the max length of string constants ('string' and "string" types).</b> Ability to limit them to say 
   256 character or to limit them to a single line are good crutches for this problem of "lost closing quote", which is present in most 
   programming language, but adequately was solved only in PL/1 optimizing complier. Missing quote is such a frequent error (along with 
   missing semicolon) that it deserve special treatment on the part  of the interpreter. For example, <tt>pragma one_line_string_literals</tt>  
   In this case interpreter can better pinpoint exact place when such an error happens. </li>

   <li><b>Subroutines should be delimited with other some keyword like </b><tt>end</tt>, <b> not with curvy brackets </b>, to allow 
   checking the banace of {}  and () brackets on closing. Right now "unclosing/running bracket often is diagnosed only at the end 
   of the script.  and you need iether to use pretty printer  to find it or extract relevant fragment in editor and run via 
   interpreter separately. </li>
</ul>

<p>For a language aficionado Larry Wall make way too many blunders in the design of Perl. Which is understandable (he has no computer 
science background and was hacker in heart), but sad. </p>

<p>There are also several semantically problems with the language: </p>
<ul>

   <li><b>While <a href="Perlorama/perl_namespaces.shtml">namespaces</a> in Perl is a thing of beauty (you can spl;it script into different 
   namespaces as you wish) they are not widely understood (mostly they are not understood at all) and outside packages very rarely used.  
   You can switch to using them with all variables with strict.  </b>O'Reilly authors are partially guilty for that (generally 
   they proved to be unable to grasp intricacies of  Perl ;-) Due to this fact, global scope of all variables looks more like a 
   design blunder, then a useful feature. It would be better as an option/pragma to allow to force the usage of local namespace for 
   each function, which would force to access encompassing "main" namespace via <tt>$:: </tt>prefix  <tt>$::myvar</tt>. So established 
   practice of writing Perl programs, as seen in into O'Reilly books leads to nasty side effects if you reuse variable inside function 
   without declaring it local or my. this abuse of "main" namespace is real problem due to which Perl is often considered  If would 
   be good if Randal L. Schwartz and other "overcomplexity junkies" instead of inventing "<i>yet another Perl idiom</i>" put some effort 
   in propagating defensive programming style:
   <ul>

      <li><b>Declaring "overlapping" internal variables</b> (<tt>my</tt> and <tt>state</tt>) in functions is one simple way to alleviate 
      the problem of global scope of variable in Perl. It is more natural then using a separate namespace for each function, but the 
      latter is more flexible. 
      <ul>

         <li>Unfortunately keyword <tt>state</tt> was introduced only in Perl 5.10 and is rarely used and poorly understood. </li>
      </ul>
      </li>

      <li><em>Possibility of use of separate namespace for each function along with the ability to access for "global namespace" via 
      prefix</em> <tt>$<b>::</b><em> </em></tt><em>is not widely understood</em>. But it is a key to defensive programming in Perl.
      </li>
   </ul>
   </li>

   <li><b>Perl  provide explicit access to interpreter symbol table (for example, the hash  <tt>%main:: </tt> represents 
   the main namespace, but not built-in functions to check the type of value assigned to the variable</b> like <tt>isnum</tt> and
   <tt>isstring</tt> This is against the spirit of the language. So there is no direct analog to R built-in function<tt> class</tt></li>

   <li><b>Until version 5.10 there was no simple way to declare a <em>persistent variable belonging to local namespace in subroutines</em>. 
   The variables were iether global or initialized on entry (my variables)</b> <b> </b>Now it can be done by declaring variable 
   as "<tt>state</tt>" instead of "<tt>my</tt>". That actually means that 5.10 should be minimal version that you should use (which 
   in 2017 is not a problems). See <a target="_blank" href="http://perldoc.perl.org/functions/state.html">state - perldoc.perl.org</a>)<blockquote>
      <ul>

         <li><code><a target="_blank" href="http://perldoc.perl.org/functions/state.html">state</a></code> declares a lexically scoped 
         variable, just like <code><a target="_blank" href="http://perldoc.perl.org/functions/my.html">my</a></code>. However, those 
         variables <em>will never be reinitialized</em>, contrary to lexical variables that are reinitialized each time their enclosing 
         block is entered. See <a target="_blank" href="http://perldoc.perl.org/perlsub.html#Persistent-Private-Variables">Persistent 
         Private Variables in perlsub</a> for details.<p>If more than one variable is listed, the list must be placed in parentheses. 
         With a parenthesized list, <code><a target="_blank" href="http://perldoc.perl.org/functions/undef.html">undef</a></code> can 
         be used as a dummy placeholder. However, since initialization of state variables in list context is currently not possible 
         this would serve no purpose.</p>

         <p><code><a target="_blank" href="http://perldoc.perl.org/functions/state.html">state</a></code> <em>variables are enabled 
         only when the</em> <code><a target="_blank" href="http://perldoc.perl.org/functions/use.html">use</a> feature "state"</code>
         <em>pragma is in effect</em>, unless the keyword is written as <code>CORE::state</code> . See also
         <a target="_blank" href="http://perldoc.perl.org/feature.html">feature</a>.</p>
         </li>
      </ul>
   </blockquote>
   </li>

   <li><b>Unquoted strings (identifiers without leading $, such as <tt>upper_limit</tt> ) should be considered to be constants.</b> 
   Value to them can be assigned via special statement (say <tt>let</tt>  or  operator <tt>:=</tt> )  only once. Currently 
   you can achieve the same effect <em>using built-in capability of Perl to invoke C preprocessor. </em></li>

   <li><b>There is no "inline" functions in Perl and functions with multiple entry points.</b>  Those are very useful inside loops.  
   the idea of different exists for <tt>break</tt> statement implemented in Python is also not bad and might be considered, although 
   Python syntax is really ugly and should be avoided. </li>

   <li><b>There is no explicit passing of parameters using </b><i>keyword-value</i><b> pairs</b> (can be simulated with a hash, so not 
   a big deal, you can automatically assume that all keywords are my variable in the function avoiding statements like <tt>my text=$_[0]</tt>  
   )</li>

   <li><b>It would be better to use symbol '<tt>^</tt>' for concatenation and use dot as in other programming languages for member functions 
   of the class/package. </b> </li>

   <li><b>Automatic detection of Unix vs. Windows encoding in data files sometimes leads to nasty surprises, when file with windows 
   encoding is processed as Unix file</b>. Extra symbol at the end of the line screw pattern matching.  It looks like Perl implicitly 
   assumes that if script is in Unix encoding data files should be in Unix encoding too. This is sometimes not the case so such assumption 
   is a deadly blunder.  There should option to force all files to specific encoding in the interpreter (like <tt>--unix</tt>)  
   as  the conversion can be implemented reading the file. Same conversion option should be available in open statement. </li>
</ul>

<h3><a name="Absence_of_good_development_environment">Absence of good development environment</a></h3>

<p>R-language has RStudio which probably can be viewed as gold standard of minimal features needed  for scripting language GUI. 
While RStudio has a weak editor it has syntax highlighting and integration with debugger and as such is adequate for medium scripts. 
</p>

<p>There is no similar "established" as standard de-facto GUI shipped with Perl interpreter and looks like nobody cares. That's a bad 
design decision although you can use Orthodox file manager (such as Midnight commander, or in Windows Far or Total Commander) as
<a href="Perlorama/perl_programming_environment.shtml#Use_Orthodox_File_Manager_for_integration">poor man IDE.</a>  Komodo Edit 
is more or less OK editor for Perl and is free although in no way it is full IDE. </p>

<p>This is not a show stopper for system administrators as they can use <tt>screen</tt>  and multiple/different  terminal 
sessions for running scripting and editing them. Also <tt>mcedit</tt> is handy and generally adequate for small scripts. To say nothing 
that each sysadmin know badic set of command for vi/vim, and many know it well. </p>

<p>But this is a problem when you try to write Perl scripts with over 1K lines which consist of multiple files.  Many things in 
modern IDE helps to avoid typical errors (for example identifiers can be picked up from the many by right clicking, braces are easier 
to match if editor provide small almost invisible vertical rulers, color of the string help to detect running string constants, etc.
</p>

<p>Currently Komodo and free Komodo editor are almost the only viable game in town. </p>

<p>See </p>
<ul>

   <li><a href="Perlorama/perl_programming_environment.shtml">Perl IDE and Programming Environment</a> </li>

   <li><a href="Perlbook/Ch01/perl_programming_environment.shtml">Perl Programming Environment</a></li>
</ul>

<p>for additional discussion. </p>

<h3><a name="Lost_development_track">Lost development priorities</a></h3>

<p>For mature language the key area of development is not questionable enhancements, but improvement of interpreter diagnostics and 
efforts in preventing typical errors (which at this point are known).</p>

<p>Perl version 5.10  was the version when <em>two very useful enhancement to the language were added</em>: </p>
<ul>

   <li><tt>state </tt><b>variables which are similar to PL/1 static variables, but are allocated on the heap</b> </li>

   <li><b>Case statement in the form:</b>

   <pre>given($answer) {
    when(condition) { ... }
    when ....
    ... ... ...
    default { ... }
} 
</pre>
   </li>
</ul>

<p>Still very little was done to improve interpreter in order to help programmers to avoid most typical Perl errors. that means that 
the quality of the editor for Perl programmers is of paramount importance. I would recommend free Komodo editor. It allows you to see 
the list of already declared variables in the program and thus avoid classic "typo in the variable" type of errors.  </p>

<p>Not all enhancements that Perl developers adopters after version 5.10 have practical value. Some, as requirement to use backslash 
in regular expressions number of iterations ( so that <tt>/\d{2}/ </tt>in "normal" Perl became<tt> /\d\{2}/</tt> in version 5.22), are 
counterproductive. For that reason I do not recommend using version 5.22. You can also use <i>pragma </i></p>

<pre>use v5.12.0</pre>

<p>to avoid stupid warnings version 5.20 generates. </p>

<p>There is no attempts to standardize Perl and do enhancements via orderly, negotiated by major stakeholders process. Like is done 
with C or Fortran (each 11 years; which is a very reasonable period which allow current fads to die ;-). At the same time quality of 
diagnostics of typical errors by Perl interpreter remains weak (it imporved with the introduction of <tt>strict</tt> though). </p>

<p>Support for a couple of useful pragma, for example, the ability to limit the length of string constants to a given length (for example 
120) for certain parts of the script is absent. Ot something similar like "do not cross the line" limitation.  </p>

<p>Local labels might help to close multiple level of nesting (the problem of missing curvy bracket is typical in al C-style languages)
</p>

<pre>
 1:if( $i==1 ){
     if( $k==0 ){
         if ($m==0 ){
   # the curvy bracket below closes all opened clock since the local label 1
 }:1 </pre>

<p>Multiple entry points into subroutines might help to organize namespaces. </p>

<p>Working with namespaces can and should be improved and rules for Perl namespaces should be much better better documented. Like pointers 
namespaces provide powerful facity to structuring language programs. which can be used with or without modules framework. this is a 
very nice and very powerful Perl feature that makes Perl a class or its own for experienced programmers. Please note that modules are 
not the only game in town. Actually the way they were constructed has some issues and (sometime stupid) overemphasis on OO only exacerbate 
those issues. Multiple entry points in procedures would be probably more useful and more efficient addition to the language. Additional 
that is very easy to implement. The desire to be like the rest of the pack often backfire... From SE point of view scripting language 
as VHL stands above OO in pecking order ;-). OO is mainly force feed for low level guys who suffer from Java... </p>

<p>Actually there are certain features that should probably be eliminated from  Perl 5. For example use of unquoted words as indexes 
to hashes is definitely a language designers blunder and should be gone.  String functions and array functions should be better 
unified. Exception mechanism should be introduced.  Assignment in  if statements should be somehow restricted. Assignment 
of constants to variables in if statement (and all conditions)  should be flagged as a clear error (as in <tt>if ($a=5)</tt> ... 
). I think latest version of Perl interpreter do this already. </p>

<h3><a name="Problems_with_Perl_5._22">Problems with Perl 5. 22</a></h3>

<p><em>Attention:</em> The release contains an obvious newly introduced wart in regex<b><i> tokenizer</i></b>, which now requires backslash 
for number of repetitions part of basic regex symbols. For example in case of <tt>/\d{2}/</tt> which you now need to write <tt>/\d\{2}/</tt> 
-- pretty illogical as<em> a curvy brace here a part of</em> <tt> \d</tt><em> construct, not a separate symbol </em>(which of course 
should be escaped);  </p>

<p>Looks to me like a typical SNAFU.  But the problem is wider and not limited to Perl. There is generally tendency for a gradual 
loss of architectural integrity after the initial author is gone and there is no strong "language standard committee" which drive the 
language development (like in Fortran, which issues an undated  version of the standard of the language each 11 years).</p>

<p>So some languages like Python this is still in the future, but for many older languages is is already reality and a real danger. 
Mechanism for preventing this are not well understood. The same situation happens with OS like Linux (systemd).  </p>

<p>This newly introduced bug (aka feature) also affects regexes that use opening curvy bracket as a delimiter. Which is a minor but 
pretty annoying "change we can believe in" ;-). I think that idiosyncrasy will prevent spread this version into production version of 
Linux Unix for a long, long time (say 10 years) or forever.  Image the task of modification of somebody else 30-50K lines Perl 
scripts for those warnings that heavily uses curvy braces in regex or use<tt> \d{1,3}</tt> constructs for parsing IP addresses.</p>

<p>This looks more and more like an artificially created year 2000 problem for Perl. </p>

<p align="right"><i>Dr. Nikolai Bezroukov</i></p>
<hr>
<table border="1" width="100%" height="350">
   <tr>
      <td width="100%" align="center" colspan="5" rowspan="4">
      <center>
      <b>Top Visited</b></center>
      <iframe src="/topupdates.shtml" width="100%" height="320">

      <p>Your browser does not support iframes.</p>
      </iframe>
      </td>
      <td bgcolor="#FFFF00" align="center"><b><a href="switchboard.shtml">Switchboard</a></b></td>
   </tr>
   <tr>
      <td bgcolor="#FFFF00" align="center"><b><a href="/index.shtml#Latest">Latest</a></b></td>
   </tr>
   <tr>
      <td bgcolor="#FFFF00" align="center"><b>
      <a href="http://www.google.com/search?q=site:www.softpanorama.org&hl=en&lr=&tbo=1&prmd=ivns&source=lnt&tbs=qdr:y&sa=X&ei=aML0TaHgO4fUgAedxtjzCw&ved=0CAsQpwUoBQ&biw=1256&bih=801&cad=cbv#q=site:www.softpanorama.org&hl=en&lr=&tbo=1&prmd=ivns&source=lnt&tbs=qdr:w&sa=X&ei=csL0TYHsI4LagAeKu7DPCw&ved=0CAwQpwUoAw&fp=fb58e14853731932&biw=1256&bih=801">
      Past week</a></b></td>
   </tr>
   <tr>
      <td bgcolor="#FFFF00" align="center"><b>
      <a href="http://www.google.com/search?q=site:www.softpanorama.org&hl=en&lr=&tbo=1&prmd=ivns&source=lnt&tbs=qdr:m&sa=X&ei=IMD0TdjLHMXUgQe9t6zfCw&ved=0CA0QpwUoBA">
      Past month</a></b></td>
   </tr>
</table
<hr noshade color="#FF0000" size="5">




<hr>

<h2><a name="NEWS_TOC">NEWS CONTENTS</a></h2>
<ul>
<li>20191201 : <a href="#n20191201X_how_can_i_export_all_subs_in_a_perl_package">How can   I export all subs in a Perl package?</a> <i></i>  ( Jan 01, 2009 , <a target="_blank" href= "https://stackoverflow.com/questions/732133/how-can-i-export-all-subs-in-a-perl-package">stackoverflow.com</a> ) </li>
<li>20191201 : <a href="#n20191201X_function_how_can_i_export_all_subs_in_a_perl_package_stack_overflow">function   - How can I export all subs in a Perl package - Stack Overflow</a> <i></i>  ( Jan 01, 2009 , <a target="_blank" href= "https://stackoverflow.com/questions/732133/how-can-i-export-all-subs-in-a-perl-package">stackoverflow.com</a> ) </li>
<li>20191129 : <a href="#n20191129X_was_mikhail_gorbachev_an_incompetent_leader_or_a_stooge_of_the_west_quora">Was   Mikhail Gorbachev an incompetent leader or a stooge of the West - Quora</a> <i></i>  ( Nov 29, 2019 , <a target="_blank" href= "https://www.quora.com/Was-Mikhail-Gorbachev-an-incompetent-leader-or-a-stooge-of-the-West">www.quora.com</a> ) </li>
<li>20191123 : <a href="#n20191123X_static_local_variables_in_perl">Static local   variables in Perl</a> <i></i>  ( Jan 01, 2012 , <a target="_blank" href= "https://stackoverflow.com/questions/10841076/static-local-variables-in-perl">stackoverflow.com</a> ) </li>
<li>20191123 : <a href="#n20191123X_introduction_to_perl_modules">Introduction to   Perl Modules</a> <i></i>  ( Nov 23, 2019 , <a target="_blank" href= "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch4.phtml#WhatIsaPerlModule">ods.com.ua</a> ) </li>
<li>20191123 : <a href="#n20191123X_min_max_sum_in_perl_using_listutil">min, max, sum in Perl using ListUtil</a> <i></i>  ( Nov 23, 2019 , <a target="_blank" href= "https://perlmaven.com/min-max-sum-using-list-util">perlmaven.com</a> ) </li>
<li>20191121 : <a href="#n20191121X_tux_nl_style_and_layout">Tux.nl - Style and   Layout</a> <i></i>  ( Nov 21, 2019 , <a target="_blank" href="http://tux.nl/style.html">tux.nl</a> ) </li>
<li>20191121 : <a href="#n20191121X_replaying_debugger_commands_from_history">Replaying   debugger commands from history</a> <i></i>  ( Nov 21, 2019 , <a target="_blank" href= "https://perlmonks.org/?node_id=11108943">perlmonks.org</a> ) </li>
<li>20191121 : <a href="#n20191121X_can_the_perl_debugger_save_the_readline_history_to_a_file">   Can the Perl debugger save the ReadLine history to a file?</a> <i></i>  ( Nov 21, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/6433241/can-the-perl-debugger-save-the-readline-history-to-a-file"> stackoverflow.com</a> ) </li>
<li>20191121 : <a href="#n20191121X_fast_common_substring_matching">Fast common   substring matching</a> <i></i>  ( Nov 21, 2019 , <a target="_blank" href= "https://perlmonks.org/?node_id=485464">perlmonks.org</a> ) </li>
<li>20191115 : <a href="#n20191115X_why_do_many_people_assume_oop_is_on_the_decline">Why do many people assume   OOP is on the decline?</a> <i></i>  ( Nov 15, 2019 , <a target="_blank" href= "https://www.quora.com/Why-do-many-people-assume-OOP-is-on-the-decline">www.quora.com</a> ) </li>
<li>20191115 : <a href="#n20191115X_why_is_perl_so_hated_and_still_commonly_used_and_why_should_i_learn_it">Why   is Perl so hated and still commonly used? And why should I learn it?</a> <i></i>  ( Nov 05, 2017 , <a target="_blank" href= "https://www.quora.com/Why-is-Perl-so-hated-and-not-commonly-used-And-why-should-I-learn-it">www.quora.com</a> ) </li>
<li>20191115 : <a href="#n20191115X_why_are_unix_system_administrators_still_using_perl_for_scripting_when_they_could">   Why are Unix system administrators still using Perl for scripting when they could use Python -   Quora</a> <i></i>  ( Nov 15, 2019 , <a target="_blank" href= "https://www.quora.com/Why-are-Unix-system-administrators-still-using-Perl-for-scripting-when-they-could-use-Python"> www.quora.com</a> ) </li>
<li>20191114 : <a href="#n20191114X_perl_package_variable_scope_in_module_subroutine_stack_overflow">perl -   package variable scope in module subroutine - Stack Overflow</a> <i></i>  ( Nov 14, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/9976813/package-variable-scope-in-module-subroutine">stackoverflow.com</a> ) </li>
<li>20191113 : <a href="#n20191113X_how_fast_is_perl_s_smartmatch_operator_when_searching_for_a_scalar_in_an_array"> How fast is Perl s smartmatch operator when searching for a scalar in an array</a> <i></i>  ( Nov 13, 2019 , <a target="_blank" href="https://stackoverflow.com/questions/3951812/how-fast-is-perls-smartmatch-operator-when-searching-for-a-scalar-in-an-array"> stackoverflow.com</a> ) </li>
<li>20191113 : <a href="#n20191113X_static_code_analysis_module_in_perl_stack_overflow">Static code   analysis module in Perl - Stack Overflow</a> <i></i>  ( Nov 13, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/10991702/static-code-analysis-module-in-perl">stackoverflow.com</a> ) </li>
<li>20191112 : <a href="#n20191112X_lib_module_checkstyle_pm">lib-Module-Checkstyle.pm </a> <i></i>  ( Nov 12, 2019 , <a target="_blank" href= "https://metacpan.org/release/Module-Checkstyle/source/lib/Module/Checkstyle.pm">metacpan.org</a> ) </li>
<li>20191112 : <a href="#n20191112X_static_code_analysis_module_in_perl_stack_overflow">Static code   analysis module in Perl - Stack Overflow</a> <i></i>  ( Nov 12, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/10991702/static-code-analysis-module-in-perl">stackoverflow.com</a> ) </li>
<li>20191112 : <a href="#n20191112X_lib_module_checkstyle_pm_metacpan_org">lib-Module-Checkstyle.pm   - metacpan.org</a> <i></i>  ( Nov 12, 2019 , <a target="_blank" href= "https://metacpan.org/release/Module-Checkstyle/source/lib/Module/Checkstyle.pm">metacpan.org</a> ) </li>
<li>20191111 : <a href="#n20191111X_how_fast_is_perl_s_smartmatch_operator_when_searching_for_a_scalar_in_an_array_stack">   How fast is Perl's smartmatch operator when searching for a scalar in an array - Stack   Overflow</a> <i></i>  ( Nov 11, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/3951812/how-fast-is-perls-smartmatch-operator-when-searching-for-a-scalar-in-an-array"> stackoverflow.com</a> ) </li>
<li>20191111 : <a href="#n20191111X_what_are_the_best_tools_for_python_static_analysis">What are the best tools for Python static  analysis  </a> <i></i>  ( Nov 11, 2019 , <a target="_blank" href="https://www.quora.com/What-are-the-best-tools-for-Python-static-analysis">www.quora.com </a>  ) </li>
<li>20191111 : <a href="#n20191111X_what_are_the_best_tools_for_python_static_analysis_quora">What are the best tools for Python static  analysis - Quora </a> <i></i>  ( Nov 11, 2019 , <a target="_blank" href="https://www.quora.com/What-are-the-best-tools-for-Python-static-analysis">www.quora.com </a>  ) </li>
<li>20191110 : <a href="#n20191110X_with_the_rename_from_perl_6_to_racu_chances_of_mass_adoption_of_the_new_language_probably">With   the rename from Perl 6 to Racu chances of mass adoption of the new language probably evaporated</a> <i></i>  ( Nov 10, 2019 , <a target="_blank" href= "https://news.ycombinator.com/item?id=10345728">news.ycombinator.com</a> ) </li>
<li>20191108 : <a href="#n20191108X_perl_tricks_for_system_administrators">Perl tricks for system   administrators</a> <i> by <a target="_blank" href="https://opensource.com/users/druthb">Ruth Holloway   Feed</a></i>  ( Jul 27, 2016 , <a target="_blank" href= "https://opensource.com/life/16/7/perl-tricks-system-administrators">opensource.com</a> ) </li>
<li>20191022 : <a href="#n20191022X_is_there_an_advantage_to_using_bash_over_perl_or_python">   Is there an advantage to using Bash over Perl or Python?</a> <i></i>  ( Oct 22, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/5858877/is-there-an-advantage-to-using-bash-over-perl-or-python"> stackoverflow.com</a> ) </li>
<li>20191022 : <a href="#n20191022X_larry_wall_approves_re_naming_perl_6_to_raku">   Larry Wall Approves Re-Naming Perl 6 To Raku</a> <i></i>  ( Oct 22, 2019 , <a target="_blank" href= "https://developers.slashdot.org/story/19/10/12/2134246/larry-wall-approves-re-naming-perl-6-to-raku"> developers.slashdot.org</a> ) </li>
<li>20191021 : <a href="#n20191021X_differences_between_perl_and_php_closed">Differences  between Perl and PHP [closed]</a> <i></i>  ( Nov 23, 2013 , <a target="_blank" href="https://stackoverflow.com/questions/2534756/differences-between-perl-and-php">stackoverflow.com</a> ) </li>
<li>20191013 : <a href="#n20191013X_how_to_eliminate_a_value_in_the_middle_of_an_array_in_perl">How to   eliminate a value in the middle of an array in Perl</a> <i> by Gabor Szabo</i>  ( Oct 13, 2019 , <a target="_blank" href= "https://perlmaven.com/how-to-eliminate-a-value-in-the-middle-of-an-array-in-perl">perlmaven.com</a> ) </li>
<li>20191013 : <a href="#n20191013X_what_are_donald_knuth_s_main_original_contributions_to_computer_science_quora">What   are Donald Knuth's main original contributions to computer science - Quora</a> <i></i>  ( Oct 13, 2019 , <a target="_blank" href= "https://www.quora.com/What-are-Donald-Knuths-main-original-contributions-to-computer-science">www.quora.com</a> ) </li>
<li>20191013 : <a href="#n20191013X_7_of_the_most_useful_perl_command_line_options">7 of   the most useful Perl command line options</a> <i> by Gabor Szabo</i>  ( Oct 13, 2019 , <a target="_blank" href= "https://perlmaven.com/perl-command-line-options">perlmaven.com</a> ) </li>
<li>20191009 : <a href="#n20191009X_static_and_state_variables_in_perl">Static and state variables in   Perl</a> <i></i>  ( Oct 09, 2019 , <a target="_blank" href= "https://perlmaven.com/static-and-state-variables-in-perl">perlmaven.com</a> ) </li>
<li>20191009 : <a href="#n20191009X_use_vars_vs_ours">use vars vs ours</a> <i></i>  ( Oct 09, 2019 , <a target="_blank" href= "https://perlmaven.com/package-variables-and-lexical-variables-in-perl">perlmaven.com</a> ) </li>
<li>20191009 : <a href="#n20191009X_scope_what_is_the_difference_between_my_and_our_in_perl_stack_overflow">scope   - What is the difference between my and our in Perl - Stack Overflow</a> <i></i>  ( Oct 09, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/845060/what-is-the-difference-between-my-and-our-in-perl">stackoverflow.com</a> ) </li>
<li>20191009 : <a href="#n20191009X_perl_import_package_in_different_namespace">Perl   Import Package in different Namespace</a> <i></i>  ( Oct 09, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/52562323/perl-import-package-in-different-namespace">stackoverflow.com</a> ) </li>
<li>20191009 : <a href="#n20191009X_oop_perl_importing_variables_from_calling_module">oop -   Perl Importing Variables From Calling Module</a> <i></i>  ( Oct 09, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/3612972/perl-importing-variables-from-calling-module">stackoverflow.com</a> ) </li>
<li>20191009 : <a href="#n20191009X_package_variables">Package   variables</a> <i></i>  ( Oct 09, 2019 , <a target="_blank" href= "https://perlmaven.com/package-variables-and-lexical-variables-in-perl">perlmaven.com</a> ) </li>
<li>20191008 : <a href="#n20191008X_perl_constant_array">Perl constant array</a> <i></i>  ( Oct 08, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/18188393/perl-constant-array">stackoverflow.com</a> ) </li>
<li>20190930 : <a href="#n20190930X_int_perldoc_perl_org">int - perldoc.perl.org</a> <i></i>  ( Sep 30, 2019 , <a target="_blank" href= "https://perldoc.perl.org/functions/int.html">perldoc.perl.org</a> ) </li>
<li>20190924 : <a href="#n20190924X_warn_perldoc_perl_org">warn -   perldoc.perl.org</a> <i></i>  ( Sep 24, 2019 , <a target="_blank" href= "https://perldoc.perl.org/functions/warn.html">perldoc.perl.org</a> ) </li>
<li>20190921 : <a href="#n20190921X_namespaces">Namespaces</a> <i></i>  ( Sep 21, 2019 , <a target="_blank" href= "https://perl.plover.com/FAQs/Namespaces.html">perl.plover.com</a> ) </li>
<li>20190921 : <a href="#n20190921X_writing_perl_modules_tutorialspoint">Writing PERL Modules - Tutorialspoint </a> <i></i>  ( Sep 21, 2019 , <a target="_blank" href="https://www.tutorialspoint.com/perl/perl_modules.htm">www.tutorialspoint.com </a>  ) </li>
<li>20190921 : <a href="#n20190921X_larry_wall_present_continuous_future_perfect_osdcisrael_wiki">Larry Wall -  Present Continuous, Future Perfect - OSDCIsrael Wiki</a> <i></i>  ( Feb 26, 2006 , <a target="_blank" href="http://perl.org.il/presentations/larry-wall-present-continuous-future-perfect/transcript.html">perl.org.il</a> ) </li>
<li>20190921 : <a href="#n20190921X_dr_dobb_s_journal_february_1998_a_conversation_with_larry_wall">Dr. Dobb's Journal February 1998 A   Conversation with Larry Wall</a> <i></i>  ( Feb 28, 1998 , <a target="_blank" href= "http://www.ddj.com/articles/1998/9802/9802a/9802a.htm">www.ddj.com</a> ) </li>
<li>20190921 : <a href="#n20190921X_half_my_life_with_perl"> Half my life with Perl</a> <i> by Randal L. Schwartz</i>  ( Sep 21, 2019 , <a target="_blank" href="https://www.socallinuxexpo.org/scale12x-supporting/default/files/presentations/my%20half%20life%20with%20Perl.pdf"> www.socallinuxexpo.org</a> ) </li>
<li>20190921 : <a href="#n20190921X_how_did_perl_lose_ground_to_bash">How Did  Perl Lose Ground to Bash?</a> <i></i>  ( Sep 21, 2019 , <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/">www.reddit.com</a> ) </li>
<li>20190919 : <a href="#n20190919X_min_and_max_functions_in_perl">Min and max functions in   Perl</a> <i> by Tim</i>  ( Feb 01, 2012 , <a target="_blank" href= "http://timmurphy.org/2012/02/01/min-and-max-functions-in-perl/">timmurphy.org</a> ) </li>
<li>20190919 : <a href="#n20190919X_luke_s_thought_dump_cute_perl_gem_to_get_the_minimum_maximum_value">Luke's   Thought Dump Cute Perl Gem to Get the Minimum-Maximum Value</a> <i></i>  ( Sep 19, 2019 , <a target="_blank" href= "https://lukesthoughtdump.blogspot.com/2009/08/cute-perl-gem-to-get-minimummaximum.html">lukesthoughtdump.blogspot.com</a> ) </li>
<li>20190919 : <a href="#n20190919X_list_moreutils_s_minmax_is_more_efficient_when_you_need_both_the_min_and_the_max_because">   List::MoreUtils's minmax is more efficient when you need both the min and the max (because it does fewer comparisons).</a> <i></i>  ( Sep 19, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/10701210/how-to-find-maximum-and-minimum-value-in-an-array-of-integers-in-perl"> stackoverflow.com</a> ) </li>
<li>20190916 : <a href="#n20190916X_perl_for_dummies_cheat_sheet">Perl   For Dummies Cheat Sheet</a> <i></i>  ( Sep 16, 2019 , <a target="_blank" href= "http://www.dummies.com/store/product/Perl-For-Dummies-4th-Edition.productCd-0764537504.html">www.dummies.com</a> ) </li>
<li>20190916 : <a href="#n20190916X_how_can_i_capture_multiple_matches_from_the_same_perl_regex_stack_overflow">   How can I capture multiple matches from the same Perl regex - Stack Overflow</a> <i></i>  ( Sep 16, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/2884549/how-can-i-capture-multiple-matches-from-the-same-perl-regex"> stackoverflow.com</a> ) </li>
<li>20190916 : <a href="#n20190916X_https_www_dummies_com_programming_perl_avoiding_common_oversights_in_perl">https://www.dummies.com/programming/perl/avoiding-common-oversights-in-perl/</a> <i></i>  ( Sep 16, 2019 , <a target="_blank" href= "https://www.dummies.com/programming/perl/avoiding-common-oversights-in-perl/">www.dummies.com</a> ) </li>
<li>20190916 : <a href="#n20190916X_switch_statements">Switch Statements</a> <i></i>  ( Sep 16, 2019 , <a target="_blank" href= "https://perldoc.perl.org/perlsyn.html#Switch-Statements">perldoc.perl.org</a> ) </li>
<li>20190912 : <a href="#n20190912X_why_is_perl_no_longer_a_popular_programming_language_quora">   Why is Perl no longer a popular programming language - Quora</a> <i></i>  ( May 19, 2019 , <a target="_blank" href= "https://www.quora.com/Why-is-Perl-no-longer-a-popular-programming-language?redirected_qid=28281947"> www.quora.com</a> ) </li>
<li>20190912 : <a href="#n20190912X_cmos_12_randal_schwartz_the_host_of_floss_weekly">CMOS   #12- Randal Schwartz the host of FLOSS Weekly</a> <i></i>  ( Sep 12, 2019 , <a target="_blank" href= "https://code-maven.com/cmos-12-randal-schwartz">code-maven.com</a> ) </li>
<li>20190912 : <a href="#n20190912X_prename_rename_files_using_any_perl_expressior_regex_tr_etc">   prename -- rename files using any perl expressior (regex, tr, etc)</a> <i></i>  ( Sep 12, 2019 , <a target="_blank" href= "https://gist.githubusercontent.com/javiermon/3939556/raw/b9d0634f2c099b825a483d3d75cae1712fb9aa31/prename.pl"> gist.githubusercontent.com</a> ) </li>
<li>20190910 : <a href="#n20190910X_perl_modules_and_namespaces">Perl Modules and namespaces</a> <i></i>  ( <a target="_blank" href="https://www.javatpoint.com/perl-modules-and-namespaces">javatpoint</a> ) </li>
<li>20190910 : <a href="#n20190910X_use_of_uninitialized_value">Use of   uninitialized value</a> <i></i>  ( Sep 10, 2019 , <a target="_blank" href= "https://perlmaven.com/search/undef">perlmaven.com</a> ) </li>
<li>20190910 : <a href="#n20190910X_how_do_i_avoid_an_uninitialized_value"> How do   I avoid an uninitialized value</a> <i></i>  ( Sep 10, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/6691874/how-do-i-avoid-an-uninitialized-value">stackoverflow.com</a> ) </li>
<li>20190910 : <a href="#n20190910X_how_do_i_check_if_a_perl_scalar_variable_has_been_initialized_stack_overflow">   How do I check if a Perl scalar variable has been initialized - Stack Overflow</a> <i></i>  ( Sep 10, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/3738836/how-do-i-check-if-a-perl-scalar-variable-has-been-initialized"> stackoverflow.com</a> ) </li>
<li>20190910 : <a href="#n20190910X_perl_multidimensional_array">Perl Multidimensional Array</a> <i></i>  ( Sep 10, 2019 , <a target="_blank" href= "https://www.javatpoint.com/perl-multidimensional-array">www.javatpoint.com</a> ) </li>
<li>20190910 : <a href="#n20190910X_perl_hashes_javatpoint">Perl Hashes - javatpoint</a> <i></i>  ( Sep 10, 2019 , <a target="_blank" href="https://www.javatpoint.com/perl-hashes">www.javatpoint.com</a> ) </li>
<li>20190910 : <a href="#n20190910X_pro_perl_debugging">Pro Perl   Debugging</a> <i></i>  ( May 12, 2012 , <a target="_blank" href= "http://books.slashdot.org/article.pl?sid=05/12/12/1448250&from=rss">Slashdot</a> ) </li>
<li>20190910 : <a href="#n20190910X_logging_perl_output_the_log_files_stack_overflow">logging - Perl - Output   the log files - Stack Overflow</a> <i></i>  ( Aug 27, 2015 , <a target="_blank" href= "https://stackoverflow.com/questions/32244474/perl-output-the-log-files">stackoverflow.com</a> ) </li>
<li>20190906 : <a href="#n20190906X_did_cia_director_william_casey_really_say_we_ll_know_our_disinformation_program_is">   Did CIA Director William Casey really say, "We'll know our disinformation program is complete   when everything the American public believes is false"?</a> <i></i>  ( Sep 06, 2019 , <a target="_blank" href= "https://www.quora.com/Did-CIA-Director-William-Casey-really-say-Well-know-our-disinformation-program-is-complete-when-everything-the-American-public-believes-is-false"> www.quora.com</a> ) </li>
<li>20190906 : <a href="#n20190906X_the_fact_that_our_leaders_continue_to_put_our_brave_young_men_and_women_in_harm_s">                                                                   The fact that our "leaders" continue to put our brave young men                                                                    and women in harm's way, as we also kill millions of "others", and                                                                    the American people stand idly by, is a proof of Casey quote . "So and                                                                    so is evil and he oppresses his people, so we need to remove him                                                                    and bring democracy to such and such country!" </a> <i></i>  ( Sep 06, 2019 , <a target="_blank" href="https://www.quora.com/Did-CIA-Director-William-Casey-really-say-Well-know-our-disinformation-program-is-complete-when-everything-the-American-public-believes-is-false">www.quora.com </a>  ) </li>
<li>20190902 : <a href="#n20190902X_perlcperl_a_perl5_with_classes_types_compilable_company_friendly">perlcperl - a perl5 with   classes, types, compilable, company friendly</a> <i></i>  ( Sep 02, 2019 , <a target="_blank" href="http://perl11.org/cperl/">perl11.org</a> ) </li>
<li>20190902 : <a href="#n20190902X_this_perl_goes_to_11">This Perl Goes To 11</a> <i></i>  ( Sep 02, 2019 , <a target="_blank" href="http://perl11.org/">perl11.org</a> ) </li>
<li>20190902 : <a href="#n20190902X_how_to_get_the_current_line_number_of_a_file_open_using_perl">   How to get the current line number of a file open using Perl</a> <i></i>  ( Sep 02, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/5920686/how-to-get-the-current-line-number-of-a-file-open-using-perl"> stackoverflow.com</a> ) </li>
<li>20190828 : <a href="#n20190828X_logprograminfo_a_perl_module_to_collect_and_log_data_for_bioinformatics_pipelines">LogProgramInfo A Perl module to collect  and log data for bioinformatics pipelines</a> <i></i>  ( Aug 28, 2019 , <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/">nlm.nih.gov</a> ) </li>
<li>20190828 : <a href="#n20190828X_echo_command_in_linux_with_examples">Echo Command in Linux with   Examples</a> <i></i>  ( Aug 28, 2019 , <a target="_blank" href= "https://linoxide.com/linux-command/echo-command-in-linux/">linoxide.com</a> ) </li>
<li>20190827 : <a href="#n20190827X_how_do_i_get_the_filename_and_line_number_in_perl_stack_overflow">How   do I get the filename and line number in Perl - Stack Overflow</a> <i></i>  ( Aug 27, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/4071447/how-do-i-get-the-filename-and-line-number-in-perl"> stackoverflow.com</a> ) </li>
<li>20190826 : <a href="#n20190826X_static_and_state_variables_in_perl">Static and state variables in   Perl</a> <i></i>  ( Aug 26, 2019 , <a target="_blank" href= "https://perlmaven.com/static-and-state-variables-in-perl">perlmaven.com</a> ) </li>
<li>20190826 : <a href="#n20190826X_beginning_perl_programming_from_novice_to_professional">   Beginning Perl Programming From Novice to Professional</a> <i></i>  ( Aug 26, 2019 , <a target="_blank" href= "https://www.amazon.com/Beginning-Perl-Programming-Novice-Professional/dp/1484250540/ref=sr_1_1?keywords=Beginning+Perl+Programming+From+Novice+to+Professional&qid=1566869069&s=gateway&sr=8-1"> www.amazon.com</a> ) </li>
<li>20190826 : <a href="#n20190826X_debugging_how_can_i_debug_a_perl_script_stack_overflow">debugging - How can I   debug a Perl script - Stack Overflow</a> <i></i>  ( Jun 27, 2014 , <a target="_blank" href= "https://stackoverflow.com/questions/4945876/how-can-i-debug-a-perl-script">stackoverflow.com</a> ) </li>
<li>20190826 : <a href="#n20190826X_d_ebugging_how_to_use_the_perl_debugger">D>ebugging - How to   use the Perl debugger</a> <i></i>  ( Aug 26, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/23233050/how-to-use-the-perl-debugger">stackoverflow.com</a> ) </li>
<li>20190803 : <a href="#n20190803X_was_future_president_george_h_w_bush_at_dealey_plaza_during_jfk_s_assassination_quora">   Was future President George H. W. Bush at Dealey Plaza during JFK's assassination -   Quora</a> <i></i>  ( Aug 03, 2019 , <a target="_blank" href= "https://www.quora.com/Was-future-President-George-H-W-Bush-at-Dealey-Plaza-during-JFKs-assassination"> www.quora.com</a> ) </li>
<li>20190427 : <a href="#n20190427X_what_are_the_main_differences_between_religion_and_ideology_quora">What are the main differences between  religion and ideology - Quora </a> <i></i>  ( Apr 27, 2019 , <a target="_blank" href="https://www.quora.com/What-are-the-main-differences-between-religion-and-ideology">www.quora.com </a>  ) </li>
<li>20190406 : <a href="#n20190406X_would_you_fly_boeing_737_max_8_ever_again_quora">Would you fly Boeing 737 Max 8 ever again - Quora </a> <i></i>  ( Apr 06, 2019 , <a target="_blank" href="https://www.quora.com/Would-you-fly-Boeing-737-Max-8-ever-again">www.quora.com </a>  ) </li>
<li>20190325 : <a href="#n20190325X_what_do_you_think_of_jared_kushner_getting_ready_to_unveil_his_economic_plan_for_peace"> What do you think of Jared Kushner getting ready to unveil his economic plan for peace in the Middle East</a> <i></i>  ( Mar 25, 2019 , <a target="_blank" href="https://www.quora.com/What-do-you-think-of-Jared-Kushner-getting-ready-to-unveil-his-economic-plan-for-peace-in-the-Middle-East">www.quora.com </a>  ) </li>
<li>20190325 : <a href="#n20190325X_is_jared_kushner_trump_s_son_in_law_the_man_to_bring_peace_to_the_middle_east_quora">   Is Jared Kushner, Trump's son-in-law, the man to bring peace to the Middle East- - Quora</a> <i></i>  ( Jan 21, 2017 , <a target="_blank" href= "https://www.quora.com/Is-Jared-Kushner-Trumps-son-in-law-the-man-to-bring-peace-to-the-Middle-East"> www.quora.com</a> ) </li>
<li>20190320 : <a href="#n20190320X_how_to_i_print_to_stderr_only_if_stdout_is_a_different_destination">   How to I print to STDERR only if STDOUT is a different destination?</a> <i></i>  ( Mar 14, 2013 , <a target="_blank" href= "https://stackoverflow.com/questions/15417397/how-to-i-print-to-stderr-only-if-stdout-is-a-different-destination"> stackoverflow.com</a> ) </li>
<li>20190306 : <a href="#n20190306X_who_will_win_the_2020_united_states_presidential_election_quora">Who will win   the 2020 United States presidential election - Quora</a> <i></i>  ( Mar 06, 2019 , <a target="_blank" href= "https://www.quora.com/Who-will-win-the-2020-United-States-presidential-election">www.quora.com</a> ) </li>
<li>20190221 : <a href="#n20190221X_perl_how_to_prompt_for_input_and_exit_if_the_user_entered_an_empty_string_stack_overflow">   perl - How to prompt for input and exit if the user entered an empty string - Stack   Overflow</a> <i></i>  ( Feb 20, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/9661379/how-to-prompt-for-input-and-exit-if-the-user-entered-an-empty-string"> stackoverflow.com</a> ) </li>
<li>20190129 : <a href="#n20190129X_new_perl_function_each_is_available_in_perl_5_14_and_later">New Perl   function each is available in Perl 5.14 and later</a> <i></i>  ( Jan 29, 2019 , <a target="_blank" href= "http://perldoc.perl.org/functions/each.html">perldoc.perl.org</a> ) </li>
<li>20190117 : <a href="#n20190117X_how_do_i_launch_the_default_web_browser_in_perl_on_any_operating_system">How do I launch the default web browser   in Perl on any operating system</a> <i></i>  ( Jan 17, 2019 , <a target="_blank" href= "http://stackoverflow.com/questions/8867262/ddg#8867668">stackoverflow.com</a> ) </li>
<li>20190110 : <a href="#n20190110X_linux_how_does_cat_eof_work_in_bash_stack_overflow">linux - How does cat   EOF work in bash - Stack Overflow</a> <i></i>  ( Jan 10, 2019 , <a target="_blank" href= "https://stackoverflow.com/questions/2500436/how-does-cat-eof-work-in-bash">stackoverflow.com</a> ) </li>
<li>20181223 : <a href="#n20181223X_founder_of_livejournal_doesn_t_know_the_definition_of_ennui">Founder   of LiveJournal doesn't know the definition of "ennui"</a> <i></i>  ( Dec 23, 2018 , <a target="_blank" href= "https://hexmode.com/2007/08/founder-of-livejournal-doesnt-know-the-definition-of-ennui/">hexmode.com</a> ) </li>
<li>20181216 : <a href="#n20181216X_what_are_the_benefits_using_docker">What are the benefits using   Docker?</a> <i></i>  ( Dec 16, 2018 , <a target="_blank" href= "https://www.quora.com/What-are-the-benefits-using-Docker">www.quora.com</a> ) </li>
<li>20181216 : <a href="#n20181216X_what_are_some_disadvantages_of_using_docker_quora">What are some disadvantages   of using Docker - Quora</a> <i></i>  ( Dec 16, 2018 , <a target="_blank" href= "https://www.quora.com/What-are-some-disadvantages-of-using-Docker">www.quora.com</a> ) </li>
<li>20181117 : <a href="#n20181117X_each_google_performance_review_consists_of_a_self_assessment_a_set_of_peer_reviews">   Each Google performance review consists of a self-assessment, a set of peer reviews, and if   you're applying for a promotion, reasons for why should be promoted to the next level</a> <i></i>  ( Nov 17, 2018 , <a target="_blank" href= "https://www.quora.com/How-are-performance-reviews-done-at-Google-What-are-they-used-for/answer/Edmond-Lau"> www.quora.com</a> ) </li>
<li>20181117 : <a href="#n20181117X_how_did_you_handle_a_bad_annual_performance_review">How did you handle a   bad annual performance review?</a> <i></i>  ( Nov 17, 2018 , <a target="_blank" href= "https://www.quora.com/How-did-you-handle-a-bad-annual-performance-review">www.quora.com</a> ) </li>
<li>20181117 : <a href="#n20181117X_should_i_argue_a_negative_performance_review">Should I argue a negative   performance review?</a> <i></i>  ( Nov 17, 2018 , <a target="_blank" href= "https://www.quora.com/Should-I-argue-a-negative-performance-review">www.quora.com</a> ) </li>
<li>20181008 : <a href="#n20181008X_how_hard_is_the_red_hat_certified_system_administrator_rhcsa_certification">   How hard is the Red Hat Certified System Administrator (RHCSA) Certification</a> <i></i>  ( Oct 08, 2018 , <a target="_blank" href= "https://www.quora.com/How-hard-is-the-Red-Hat-Certified-System-Administrator-RHCSA-Certification"> www.quora.com</a> ) </li>
<li>20181008 : <a href="#n20181008X_i_have_been_meeting_more_and_more_americans_abroad_who_permanently_left_the_us_and"> I have been meeting more and more                                                           Americans abroad who permanently left the US and told me it was the best                                                           thing they did, or that they never want to go back. Why is that so? Is it                                                           due to POTUS? </a> <i></i>  ( Oct 08, 2018 , <a target="_blank" href="https://www.quora.com/I-have-been-meeting-more-and-more-Americans-abroad-who-permanently-left-the-U-S-and-told-me-it-was-the-best-thing-they-did-or-that-they-never-want-to-go-back-Why-is-that-so-Is-it-due-to-POTUS">www.quora.com </a>  ) </li>
<li>20180921 : <a href="#n20180921X_preferred_editor_or_ide_for_development_work_red_hat_learning_community">   Preferred editor or IDE for development work - Red Hat Learning Community</a> <i></i>  ( Sep 21, 2018 , <a target="_blank" href= "https://learn.redhat.com/t5/Developer-Middleware/Preferred-editor-or-IDE-for-development-work/m-p/361"> learn.redhat.com</a> ) </li>
<li>20180910 : <a href="#n20180910X_parsing_html_with_perl">Parsing HTML with Perl</a> <i> by <a target="_blank" href=     "http://radar.oreilly.com/asunur">A. Sinan Unur</a></i>  ( Feb 06, 2014 , <a target="_blank" href= "http://radar.oreilly.com/2014/02/parsing-html-with-perl-2.html">radar.oreilly.com</a> ) </li>
<li>20180528 : <a href="#n20180528X_handling_binary_files_in_perl">Handling Binary   Files in Perl</a> <i></i>  ( May 28, 2018 , <a target="_blank" href= "http://www.devx.com/DevX/Tip/17116">www.devx.com</a> ) </li>
<li>20180509 : <a href="#n20180509X_reading_binary_files_with_perl">reading binary files with Perl </a> <i></i>  ( May 09, 2018 , <a target="_blank" href="http://www.perlmonks.org/bare/?node_id=584492">www.perlmonks.org </a>  ) </li>
<li>20180509 : <a href="#n20180509X_how_to_read_binary_file_in_perl_stack_overflow">How to read binary file in Perl  - Stack Overflow </a> <i></i>  ( May 09, 2018 , <a target="_blank" href="https://stackoverflow.com/questions/8920215/how-to-read-binary-file-in-perl">stackoverflow.com </a>  ) </li>
<li>20180504 : <a href="#n20180504X_bit_manipulation_bit_operations_in_perl">bit manipulation - Bit   operations in Perl</a> <i></i>  ( May 04, 2018 , <a target="_blank" href= "https://stackoverflow.com/questions/4670109/bit-operations-in-perl">stackoverflow.com</a> ) </li>
<li>20171221 : <a href="#n20171221X_common_syntax_errors">Common   Syntax Errors</a> <i></i>  ( Dec 21, 2017 , <a target="_blank" href= "https://affy.blogspot.com/p5be/ch16.htm">affy.blogspot.com</a> ) </li>
<li>20171220 : <a href="#n20171220X_chomp_perldoc_perl_org">chomp - perldoc.perl.org</a> <i></i>  ( Dec 20, 2017 , <a target="_blank" href="http://perldoc.perl.org/functions/chomp.html">perldoc.perl.org</a> ) </li>
<li>20171220 : <a href="#n20171220X_teach_yourself_perl_5_in_21_days_table_of_contents">Teach Yourself   Perl 5 in 21 days - Table of Contents</a> <i></i>  ( Dec 20, 2017 , <a target="_blank" href= "http://www.davetill.com/perlbook/">www.davetill.com</a> ) </li>
<li>20171220 : <a href="#n20171220X_debugging_can_the_perl_debugger_save_the_readline_history_to_a_file">   debugging - Can the Perl debugger save the ReadLine history to a file </a> <i></i>  ( Dec 20, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/6433241/can-the-perl-debugger-save-the-readline-history-to-a-file"> stackoverflow.com</a> ) </li>
<li>20171220 : <a href="#n20171220X_the_perl_debugger">The Perl Debugger</a> <i></i>  ( Dec 20, 2017 , <a target="_blank" href= "https://nnc3.com/mags/LJ_1994-2014/LJ/049/2484.html">nnc3.com</a> ) </li>
<li>20171220 : <a href="#n20171220X_creating_command_aliases">Creating   Command Aliases</a> <i></i>  ( Dec 20, 2017 , <a target="_blank" href= "https://affy.blogspot.com/p5be/ch16.htm">affy.blogspot.com</a> ) </li>
<li>20171220 : <a href="#n20171220X_perl_debugger_quick_reference_card">Perl   Debugger Quick Reference Card</a> <i> by Andrew Ford</i>  ( Dec 20, 2017 , <a target="_blank" href= "http://shinnok.com/cheatsheets/programming-scripting/perl/perl-debugger-refcard.pdf">shinnok.com</a> ) </li>
<li>20171220 : <a href="#n20171220X_chapter_30_using_the_perl_debugger">Chapter 30 -- Using the  Perl Debugger </a> <i></i>  ( Dec 20, 2017 , <a target="_blank" href="http://www.ods.com.ua/win/eng/program/Perl5Unleashed/ch30.phtml">ods.com.ua </a> ) </li>
<li>20171219 : <a href="#n20171219X_perl_ide_and_editor_poll_october_2009_which_editor_s_or_ide_s_are_you_using_for_perl">Perl IDE and Editor   Poll, October 2009 - Which editor(s) or IDE(s) are you using for Perl development</a> <i></i>  ( Oct 01, 2009 , <a target="_blank" href= "http://perlide.org/poll200910/">perlide.org</a> ) </li>
<li>20171219 : <a href="#n20171219X_programming_in_perl_debugging">Programming in Perl -   Debugging</a> <i></i>  ( Mar 13, 2007 , <a target="_blank" href= "http://cgi2.cs.rpi.edu/~lallip/perl/fall05/debugging.shtml">cs.rpi.edu</a> ) </li>
<li>20171219 : <a href="#n20171219X_open_perl_ide_user_manual">Open Perl   IDE - User Manual</a> <i></i>  ( Dec 19, 2017 , <a target="_blank" href= "http://open-perl-ide.sourceforge.net/documentation/user-manual/script_debugging.html">open-perl-ide.sourceforge.net</a> ) </li>
<li>20171219 : <a href="#n20171219X_antibugging_in_perl_7_tips_for_reducing_complexity">Antibugging in Perl   7 Tips for Reducing Complexity</a> <i></i>  ( Dec 19, 2017 , <a target="_blank" href= "http://www.informit.com/articles/article.asp?p=167848&seqNum=8&rl=1">www.informit.com</a> ) </li>
<li>20171219 : <a href="#n20171219X_cultured_perl_debugging_perl_with_ease_catch_the_bugs_before_they_bite">Cultured Perl: Debugging Perl   with ease. Catch the bugs before they bite</a> <i></i>  ( Nov 01, 2000 , <a target="_blank" href= "https://www.ibm.com/developerworks/library/l-pl-deb/index.html">www.ibm.com</a> ) </li>
<li>20171208 : <a href="#n20171208X_perl_debugger_tutorial_10_easy_steps_to_debug_perl_program">Perl Debugger Tutorial 10 Easy Steps to   Debug Perl Program</a> <i></i>  ( Dec 08, 2017 , <a target="_blank" href= "http://www.thegeekstuff.com/2010/05/perl-debugger/">www.thegeekstuff.com</a> ) </li>
<li>20171203 : <a href="#n20171203X_debugging_regular_expressions">Debugging Regular   Expressions</a> <i></i>  ( Dec 03, 2017 , <a target="_blank" href= "http://my.safaribooksonline.com/0201795264/ch09img#p222pro01a">my.safaribooksonline.com</a> ) </li>
<li>20171203 : <a href="#n20171203X_just_writing_the_tests_is_often_a_damn_fine_way_of_finding_bugs">Just writing the tests is often a damn fine way of  finding bugs</a> <i></i>  ( Nov 15, 2017 , <a target="_blank" href="http://perlmonks.com/?node_id=560640">perlmonks.com</a> ) </li>
<li>20171203 : <a href="#n20171203X_strategies_for_maintenance_of_horrible_code">Strategies for maintenance of horrible code? </a> <i></i>  ( Jul 12, 2006 , <a target="_blank" href="http://perlmonks.com/?node_id=17361">perlmonks.com </a> ) </li>
<li>20171203 : <a href="#n20171203X_core_module_tie_file_access_the_lines_of_a_disk_file_via_a_perl_array">Core module   Tie::File - Access the lines of a disk file via a Perl array</a> <i></i>  ( Dec 03, 2017 , <a target="_blank" href= "http://perldoc.perl.org/Tie/File.html">perldoc.perl.org</a> ) </li>
<li>20171201 : <a href="#n20171201X_regex_debugging_perl_regular_expression">regex -  Debugging Perl Regular expression</a> <i></i>  ( Dec 01, 2017 , <a target="_blank" href="https://stackoverflow.com/questions/11127800/debugging-perl-regular-expression">stackoverflow.com</a> ) </li>
<li><em>20171130* </em><a href="#a20171130X_debugging_perl_debugger_filehandle_as_input">debugging  - Perl Debugger Filehandle as Input</a> <i></i> <em> ( Nov 30, 2017 , <a target="_blank" href="https://stackoverflow.com/questions/31102558/perl-debugger-filehandle-as-input">stackoverflow.com</a> ) [Recommended]</em> </li>
<li>20171130 : <a href="#n20171130X_working_with_character_arrays_in_perl">Working   with character arrays in perl</a> <i></i>  ( Nov 30, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/24609413/working-with-character-arrays-in-perl?rq=1">stackoverflow.com</a> ) </li>
<li>20171130 : <a href="#n20171130X_working_with_character_arrays_in_perl">Working   with character arrays in perl</a> <i></i>  ( Nov 30, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/24609413/working-with-character-arrays-in-perl?rq=1">stackoverflow.com</a> ) </li>
<li>20171129 : <a href="#n20171129X_how_can_i_have_variable_assertions_in_perl">How can I have variable assertions in Perl </a> <i></i>  ( Nov 29, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/1023813/how-can-i-have-variable-assertions-in-perl">stackoverflow.com</a> ) </li>
<li>20171129 : <a href="#n20171129X_how_can_i_have_variable_assertions_in_perl">How can I have variable assertions in Perl </a> <i></i>  ( Nov 29, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/1023813/how-can-i-have-variable-assertions-in-perl">stackoverflow.com</a> ) </li>
<li>20171123 : <a href="#n20171123X_a_perl_array_contains_example">A Perl array   'contains' example</a> <i> by Alvin Alexander</i>  ( Jun 03, 2016 , <a target="_blank" href= "https://alvinalexander.com/perl/perl-array-contains-grep-search-how-test">alvinalexander.com</a> ) </li>
<li>20171122 : <a href="#n20171122X_edited_yesterday">edited yesterday</a> <i></i>  ( Nov 22, 2017 , <a target="_blank" href= "https://stackoverflow.com/posts/47299805/revisions">stackoverflow.com</a> ) </li>
<li>20171122 : <a href="#n20171122X_perl_modules">Perl   modules</a> <i></i>  ( Nov 17, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=1203564">perlmonks.com</a> ) </li>
<li>20171122 : <a href="#n20171122X_perl_grep_array_faq_how_to_search_an_array_list_of_strings_alvinalexander_com">Perl   grep array FAQ - How to search an array-list of strings alvinalexander.com</a> <i></i>  ( Nov 22, 2017 , <a target="_blank" href= "https://alvinalexander.com/blog/post/perl/how-search-perl-list-array-strings-grep-function">alvinalexander.com</a> ) </li>
<li>20171122 : <a href="#n20171122X_perl_how_can_i_also_get_an_element_s_index_when_i_grep_through_an_array_stack_overflow">   perl - How can I also get an element's index when I grep through an array - Stack   Overflow</a> <i></i>  ( Nov 22, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/3016447/how-can-i-also-get-an-elements-index-when-i-grep-through-an-array"> stackoverflow.com</a> ) </li>
<li>20171122 : <a href="#n20171122X_perl_searching_for_item_in_an_array_stack_overflow">Perl Searching   for item in an Array - Stack Overflow</a> <i></i>  ( Nov 22, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/10240458/perl-searching-for-item-in-an-array">stackoverflow.com</a> ) </li>
<li>20171122 : <a href="#n20171122X_bitwise_operators_supported_by_perl_language">Bitwise   operators supported by Perl language</a> <i></i>  ( Nov 18, 2017 , <a target="_blank" href= "https://www.tutorialspoint.com/perl/bitwise_operators_example.htm">www.tutorialspoint.com</a> ) </li>
<li>20171122 : <a href="#n20171122X_bitwise_operators_supported_by_perl_language">Bitwise   operators supported by Perl language</a> <i></i>  ( Nov 18, 2017 , <a target="_blank" href= "https://www.tutorialspoint.com/perl/bitwise_operators_example.htm">www.tutorialspoint.com</a> ) </li>
<li>20171118 : <a href="#n20171118X_using_the_built_in_debugger_of_perl_as_repl">Using the built-in debugger of Perl as REPL</a> <i> by <a target="_blank" href="https://www.youtube.com/channel/UCGsgaBYSAcia5op2Umer-9g">Gabor Szabo</a></i>  ( Nov 18, 2017 , <a target="_blank" href="https://www.youtube.com/watch?v=pL_nDlXNqLY">www.youtube.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_why_key_function_applied_to_hash_reference_adds_reference_to_the_hash_if_it_does_not">Why key function applied to hash   reference adds reference to the hash if it does not exist</a> <i></i>  ( Nov 17, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=1203648">perlmonks.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_meteoalarm_weather_warnings">Meteoalarm -   Weather warnings</a> <i></i>  ( Nov 17, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=1199950">perlmonks.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_safe_string_handling">Safe string   handling</a> <i></i>  ( Nov 17, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=1198023">perlmonks.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_ndexed_flat_file_databases_for_isam_nosql_perl_embedded_databases">ndexed Flat   File databases (for ISAM, NoSQL, Perl Embedded databases)</a> <i></i>  ( Nov 17, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=1200947">perlmonks.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_how_do_the_perl_6_set_operations_compare_elements">How   do the Perl 6 set operations compare elements?</a> <i></i>  ( Nov 17, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/40814933/how-do-the-perl-6-set-operations-compare-elements"> stackoverflow.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_introducing_testsimple_for_testing_perl_programs_youtube">Introducing TestSimple for testing Perl programs -   YouTube</a> <i></i>  ( Nov 17, 2017 , <a target="_blank" href= "https://www.youtube.com/watch?v=NTQ7W1kCu74">www.youtube.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_bruce_gray_your_perl_5_brain_on_perl_6">Bruce   Gray - Your Perl 5 Brain, on Perl 6 > </a> <i> by Bruce Gray</i>  ( Nov 17, 2017 , <a target="_blank" href= "https://www.youtube.com/watch?v=EUXclZ_d0DQ">www.youtube.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_bit_operations_in_perl">Bit operations in   Perl</a> <i></i>  ( Nov 17, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/4670109/bit-operations-in-perl">stackoverflow.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_date_how_to_convert_epoch_seconds_to_normal_time_in_perl_stack_overflow">   date - How to convert epoch seconds to normal time in perl - Stack Overflow</a> <i></i>  ( Nov 17, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/47299976/how-to-convert-epoch-seconds-to-normal-time-in-perl"> stackoverflow.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_meteoalarm_weather_warnings">Meteoalarm -   Weather warnings</a> <i></i>  ( Nov 17, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=1199950">perlmonks.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_safe_string_handling">Safe string   handling</a> <i></i>  ( Nov 17, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=1198023">perlmonks.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_ndexed_flat_file_databases_for_isam_nosql_perl_embedded_databases">ndexed Flat   File databases (for ISAM, NoSQL, Perl Embedded databases)</a> <i></i>  ( Nov 17, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=1200947">perlmonks.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_how_do_the_perl_6_set_operations_compare_elements">How   do the Perl 6 set operations compare elements?</a> <i></i>  ( Nov 17, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/40814933/how-do-the-perl-6-set-operations-compare-elements"> stackoverflow.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_introducing_testsimple_for_testing_perl_programs_youtube">Introducing TestSimple for testing Perl programs -   YouTube</a> <i></i>  ( Nov 17, 2017 , <a target="_blank" href= "https://www.youtube.com/watch?v=NTQ7W1kCu74">www.youtube.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_bruce_gray_your_perl_5_brain_on_perl_6">Bruce   Gray - Your Perl 5 Brain, on Perl 6 </a> <i> by Bruce Gray</i>  ( Nov 17, 2017 , <a target="_blank" href= "https://www.youtube.com/watch?v=EUXclZ_d0DQ">www.youtube.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_bit_operations_in_perl">Bit operations in   Perl</a> <i></i>  ( Nov 17, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/4670109/bit-operations-in-perl">stackoverflow.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_date_how_to_convert_epoch_seconds_to_normal_time_in_perl_stack_overflow">   date - How to convert epoch seconds to normal time in perl - Stack Overflow</a> <i></i>  ( Nov 17, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/47299976/how-to-convert-epoch-seconds-to-normal-time-in-perl"> stackoverflow.com</a> ) </li>
<li>20171117 : <a href="#n20171117X_using_the_built_in_debugger_of_perl">Using   the built-in debugger of Perl</a> <i> by <a target="_blank" href=   "https://www.youtube.com/channel/UCGsgaBYSAcia5op2Umer-9g">Gabor Szabo</a></i>  ( Nov 17, 2017 , <a target="_blank" href= "https://www.youtube.com/watch?v=jiYZcV3khdY">www.youtube.com</a> ) </li>
<li>20171116 : <a href="#n20171116X_namespaces_and_modules">Namespaces and modules</a> <i></i>  ( Feb 09, 2015 , <a target="_blank" href="http://perlmonks.com/?node_id=1116049">perlmonks.com</a> ) </li>
<li>20171116 : <a href="#n20171116X_perl_grep_two_dimensional_array_stack_overflow">perl - Grep Two   Dimensional Array - Stack Overflow</a> <i></i>  ( Nov 16, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/47287725/grep-two-dimensional-array">stackoverflow.com</a> ) </li>
<li>20171116 : <a href="#n20171116X_connecting_with_netftp_in_perl_but_fails_to_upload_stack_overflow">   Connecting with NetFTP in Perl, but fails to upload - Stack Overflow</a> <i></i>  ( Nov 16, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/47221877/connecting-with-netftp-in-perl-but-fails-to-upload"> stackoverflow.com</a> ) </li>
<li>20171116 : <a href="#n20171116X_re_4_strange_behaviour_of_tr_function_in_case_the_set1_is_supplied_by_a_variable">Re^4 Strange behaviour of tr   function in case the set1 is supplied by a variable</a> <i></i>  ( Nov 16, 2017 , <a target="_blank" href="http://perlmonks.com/?">perlmonks.com</a> ) </li>
<li>20171116 : <a href="#n20171116X_accessing_a_filehandle_which_is_defined_in_main_program_from_different_modules">   Accessing a filehandle which is defined in main program from different modules</a> <i></i>  ( Nov 11, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/47235215/accessing-a-filehandle-which-is-defined-in-main-program-from-different-modules"> stackoverflow.com</a> ) </li>
<li>20171116 : <a href="#n20171116X_generating_a_range_of_unicode_characters">Generating a   range of Unicode characters</a> <i></i>  ( Nov 16, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=1203553">perlmonks.com</a> ) </li>
<li>20171116 : <a href="#n20171116X_regex_parsing_a_whole_file_in_perl">regex - Parsing a   whole file in Perl</a> <i></i>  ( Nov 12, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/47247440/parsing-a-whole-file-in-perl">stackoverflow.com</a> ) </li>
<li>20171116 : <a href="#n20171116X_perl_perlpacktut_not_making_sense_for_me_stack_overflow">perl   perlpacktut not making sense for me - Stack Overflow</a> <i></i>  ( Nov 13, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/47255219/perl-perlpacktut-not-making-sense-for-me">stackoverflow.com</a> ) </li>
<li>20171116 : <a href="#n20171116X_generating_a_range_of_unicode_characters">Generating a   range of Unicode characters</a> <i></i>  ( Nov 16, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=1203553">perlmonks.com</a> ) </li>
<li>20171116 : <a href="#n20171116X_regex_parsing_a_whole_file_in_perl">regex - Parsing a   whole file in Perl</a> <i></i>  ( Nov 12, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/47247440/parsing-a-whole-file-in-perl">stackoverflow.com</a> ) </li>
<li>20171116 : <a href="#n20171116X_perl_perlpacktut_not_making_sense_for_me_stack_overflow">perl   perlpacktut not making sense for me - Stack Overflow</a> <i></i>  ( Nov 13, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/47255219/perl-perlpacktut-not-making-sense-for-me">stackoverflow.com</a> ) </li>
<li>20171116 : <a href="#n20171116X_perl_passing_an_inner_array_to_a_function_stack_overflow">perl -   Passing an inner array to a function - Stack Overflow</a> <i></i>  ( Nov 16, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/47306924/passing-an-inner-array-to-a-function">stackoverflow.com</a> ) </li>
<li>20171116 : <a href="#n20171116X_perl_get_reference_to_temp_list_returned_by_function_without_making_a_copy_stack_overflow">   perl get reference to temp list returned by function without making a copy - Stack   Overflow</a> <i></i>  ( Nov 16, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/47258873/perl-get-reference-to-temp-list-returned-by-function-without-making-a-copy"> stackoverflow.com</a> ) </li>
<li>20171115 : <a href="#n20171115X_strange_behaviour_of_tr_function_in_case_the_set1_is_supplied_by_a_variable">Strange behaviour of tr function in case the set1  is supplied by a variable</a> <i></i>  ( Nov 15, 2017 , <a target="_blank" href="http://perlmonks.com/?node_id=1203542">perlmonks.com</a> ) </li>
<li>20171115 : <a href="#n20171115X_converter">converter</a> <i></i>  ( Nov 15, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=17361">perlmonks.com</a> ) </li>
<li>20171115 : <a href="#n20171115X_suggestions_for_working_with_poor_code">Suggestions for   working with poor code</a> <i></i>  ( Nov 15, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=79261">perlmonks.com</a> ) </li>
<li>20171115 : <a href="#n20171115X_a_crucial_element_in_controlling_time_is_controlling_the_amount_of_detail_needed_to">A crucial   element in controlling time is controlling the amount of detail needed to gain understanding. It   is easy to lose sight of the forest for the trees.</a> <i></i>  ( Nov 15, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=788410">perlmonks.com</a> ) </li>
<li>20171115 : <a href="#n20171115X_xref_helped_me_make_sense_of_the_interactions_in_the_old_codebase_i_didn_t_bother">Xref helped me   make sense of the interactions in the old codebase. I didn't bother with any visualization tools   or graph-creation, though. I just took the output of  perl -MO=Xref filename  for each   file, removed some of the cruft with a text editor, ran it through  mpage -4  to print,   and spent a day with coffee and pencil, figuring out how things worked.</a> <i></i>  ( Nov 15, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=448222">perlmonks.com</a> ) </li>
<li>20171115 : <a href="#n20171115X_generating_documentation_from_perl_code">Generating   documentation from Perl code</a> <i></i>  ( Nov 15, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=378573">perlmonks.com</a> ) </li>
<li>20171115 : <a href="#n20171115X_generating_documentation_from_perl_code_not_just_pod">   Generating documentation from Perl code (not just POD)</a> <i></i>  ( Nov 15, 2017 , <a target="_blank" href= "http://perlmonks.com/?node=Generating%20documentation%20from%20Perl%20code%20(not%20just%20POD)"> perlmonks.com</a> ) </li>
<li>20171115 : <a href="#n20171115X_with_regard_to_the_to_do_list_i_scatter_them_throughout_my_code_if_there_is_a_place">With regard to   the To Do list, I scatter them throughout my code if there is a place I need to do further   work.</a> <i></i>  ( Nov 15, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=79261">perlmonks.com</a> ) </li>
<li>20171115 : <a href="#n20171115X_basic_debugger_commands">Basic Debugger Commands</a> <i></i>  ( Nov 15, 2017 , <a target="_blank" href= "http://my.safaribooksonline.com/0201795264/ch09img#p217pro01a">my.safaribooksonline.com</a> ) </li>
<li>20171115 : <a href="#n20171115X_preface_modern_perl_2011_2012">Preface (Modern Perl 2011-2012)</a> <i></i>  ( Nov 15, 2017 , <a target="_blank" href= "http://modernperlbooks.com/books/modern_perl/">modernperlbooks.com</a> ) </li>
<li>20171114 : <a href="#n20171114X_perl_archeology_need_help_in_refactoring_of_old_perl_code_that_does_not_use_strict">Perl archeology Need help in refactoring of old Perl  code that does not use strict</a> <i></i>  ( Nov 14, 2017 , <a target="_blank" href="http://perlmonks.com/?node_id=1203327">perlmonks.com</a> ) </li>
<li>20171114 : <a href="#n20171114X_scoping_what_is_the_difference_between_my_and_local_in_perl_stack_overflow">scoping   - What is the difference between my and local in Perl - Stack Overflow</a> <i></i>  ( Nov 14, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/129607/what-is-the-difference-between-my-and-local-in-perl"> stackoverflow.com</a> ) </li>
<li>20171113 : <a href="#n20171113X_how_to_export_names_from_one_namespace_into_another">How to export    names from one namespace into another</a> <i></i>  ( Nov 13, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/22844514/use-a-variable-from-one-file-into-another">stackoverflow.com</a> ) </li>
<li>20171113 : <a href="#n20171113X_aristotle73">aristotle73</a> <i></i>  ( Nov 13, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=416283">perlmonks.com</a> ) </li>
<li>20171113 : <a href="#n20171113X_no_title">no title</a> <i></i>  ( Dec 28, 2006 , </a><a target="_blank" href="http://perlmonks.com/?node_id=592054">perlmonks.com</a> ) </li>
<li>20171113 : <a href="#n20171113X_strip_pod_as_pod_from_perl_file_stack_overflow">Strip Pod as   Pod from Perl file - Stack Overflow</a> <i></i>  ( Nov 13, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/26699140/strip-pod-as-pod-from-perl-file?rq=1">stackoverflow.com</a></b> ) </li>
<li>20171113 : <a href="#n20171113X_translation_substring_error">Translation   Substring Error</a> <i></i>  ( Nov 13, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=1203047">perlmonks.com</a> ) </li>
<li>20171113 : <a href="#n20171113X_strip_pod_as_pod_from_perl_file_stack_overflow">Strip Pod as   Pod from Perl file - Stack Overflow</a> <i></i>  ( <b>Nov 13, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/26699140/strip-pod-as-pod-from-perl-file?rq=1">stackoverflow.com</a></b> ) </li>
<li>20171113 : <a href="#n20171113X_translation_substring_error">Translation   Substring Error</a> <i></i>  ( Nov 09, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=1203047">perlmonks.com</a> ) </li>
<li>20171113 : <a href="#n20171113X_our_is_not_my">'our' is not   'my'</a> <i> by Ovid</i>  ( Nov 13, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=105446">perlmonks.com</a> ) </li>
<li>20171113 : <a href="#n20171113X_variable_scope">Variable   Scope</a> <i></i>  ( Nov 13, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=1203128">perlmonks.com</a> ) </li>
<li>20171113 : <a href="#n20171113X_how_to_declare_perl_variable_without_using_my_stack_overflow">   How to declare perl variable without using my - Stack Overflow</a> <i></i>  ( Nov 13, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/16682085/how-to-declare-perl-variable-without-using-my?noredirect=1&lq=1"> stackoverflow.com</a> ) </li>
<li>20171113 : <a href="#n20171113X_perl_why_use_strict_and_warnings">perl - Why use strict   and warnings</a> <i></i>  ( Nov 13, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/8023959/why-use-strict-and-warnings">stackoverflow.com</a> ) </li>
<li>20171113 : <a href="#n20171113X_basic_debugging_checklist">Basic debugging checklist</a> <i> by <a target="_blank" href="http://perlmonks.com/?node_id=622051">toolic</a></i>  ( Feb 23, 2009 , <a target="_blank" href= "http://perlmonks.com/?node=Basic%20debugging%20checklist">perlmonks.com</a> ) </li>
<li>20171112 : <a href="#n20171112X_understanding_split_and_join">Understanding   Split and Join</a> <i></i>  ( Nov 12, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=591988">perlmonks.com</a> ) </li>
<li>20171112 : <a href="#n20171112X_understanding_split_and_join">Understanding   Split and Join</a> <i></i>  ( Nov 12, 2017 , <a target="_blank" href= "http://perlmonks.com/?node_id=591988">perlmonks.com</a> ) </li>
<li>20171108 : <a href="#n20171108X_in_perl_how_can_i_concisely_check_if_a_variable_is_defined_and_contains_a_non_zero">   In Perl, how can I concisely check if a $variable is defined and contains a non zero length   string?</a> <i></i>  ( Nov 08, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/1480066/in-perl-how-can-i-concisely-check-if-a-variable-is-defined-and-contains-a-non"> stackoverflow.com</a> ) </li>
<li>20171108 : <a href="#n20171108X_skipping_null_empty_fields_caught_by_split">Skipping   null/empty fields caught by split()</a> <i></i>  ( Jun 01, 2019 , <a target="_blank" href= "http://bytes.com/topic/perl/answers/870727-skipping-null-empty-fields-caught-split">bytes.com</a> ) </li>
<li>20171108 : <a href="#n20171108X_a_tip_from_perl_debugged"> A tip from Perl Debugged</a> <i></i>  ( <a target="_blank" href="https://sanctum.geek.nz/arabesque/vim-filename-completion/">sanctum.geek.nz</a> ) </li>
<li>20171108 : <a href="#n20171108X_the_perl_debugger_starting">   The Perl Debugger Starting</a> <i></i>  ( Nov 08, 2017 , <a target="_blank" href= "https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias=stripbooks&field-keywords=Perl+debugged"> www.amazon.com</a> ) </li>
<li>20171106 : <a href="#n20171106X_what_is_difference_between_namespace_package_and_module_in_perl">   What is difference between namespace,package and module in perl </a> <i></i>  ( Nov 06, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/14190483/what-is-difference-between-namespace-package-and-module-in-perl"> stackoverflow.com</a> ) </li>
<li>20171106 : <a href="#n20171106X_in_perl_what_is_the_difference_between_a_pm_perl_module_and_pl_perl_script_file">   In Perl, what is the difference between a .pm (Perl module) and .pl (Perl script) file</a> <i></i>  ( Nov 06, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/3402821/in-perl-what-is-the-difference-between-a-pm-perl-module-and-pl-perl-script?rq=1"> stackoverflow.com</a> ) </li>
<li>20171106 : <a href="#n20171106X_how_to_create_a_perl_module_for_code_reuse">How to create a Perl Module  for code reuse</a> <i></i>  ( Nov 06, 2017 , <a target="_blank" href="https://perlmaven.com/how-to-create-a-perl-module-for-code-reuse">perlmaven.com</a> ) </li>
<li>20171106 : <a href="#n20171106X_scope_what_is_the_difference_between_my_and_our_in_perl_stack_overflow"> scope - What is the difference between my and our in Perl - Stack Overflow</a> <i></i>  ( Nov 06, 2017 , <a target="_blank" href="https://stackoverflow.com/questions/845060/what-is-the-difference-between-my-and-our-in-perl?rq=1"> stackoverflow.com</a> ) </li>
<li>20171106 : <a href="#n20171106X_constants_and_read_only_variables_in_perl">Constants and read-only   variables in Perl</a> <i> by <a target="_blank" href=   "https://plus.google.com/102810219707784087582?rel=author">Gabor Szabo</a></i>  ( Nov 06, 2017 , <a target="_blank" href= "https://perlmaven.com/constants-and-read-only-variables-in-perl">perlmaven.com</a> ) </li>
<li>20171106 : <a href="#n20171106X_perl_string_concatenation_and_repetition">Perl string   concatenation and repetition</a> <i> by <a target="_blank" href=   "https://plus.google.com/114750365184767547578">Andrew Solomon</a></i>  ( Nov 06, 2017 , <a target="_blank" href= "http://blog.geekuni.com/2017/10/perl-string-concatenation-and-repetition.html">blog.geekuni.com</a> ) </li>
<li>20171106 : <a href="#n20171106X_split_retaining_the_separator_or_parts_of_it_in_perl">Split retaining the separator or parts of   it in Perl</a> <i></i>  ( Nov 06, 2017 , <a target="_blank" href= "https://perlmaven.com/split-retaining-the-separator">perlmaven.com</a> ) </li>
<li>20171031 : <a href="#n20171031X_perl_references_explained">Perl references  explained</a> <i> by <a target="_blank" href="https://sanctum.geek.nz/arabesque/author/tom/">Tom Ryder</a> </i>  ( Jan 27, 2012 , <a target="_blank" href="https://sanctum.geek.nz/arabesque/perl-references-explained/">sanctum.geek.nz</a> ) </li>
<li>20171019 : <a href="#n20171019X_how_can_i_translate_a_shell_script_to_perl">How can   I translate a shell script to Perl</a> <i></i>  ( Oct 19, 2017 , <a target="_blank" href= "https://stackoverflow.com/questions/1152400/how-can-i-translate-a-shell-script-to-perl">stackoverflow.com</a> ) </li>
<li>20171016 : <a href="#n20171016X_indenting_here_documents">Indenting Here Documents</a> <i></i>  ( Oct 16, 2017 , <a target="_blank" href= "https://docstore.mik.ua/orelly/perl/cookbook/ch01_12.htm">docstore.mik.ua</a> ) </li>
<li>20171016 : <a href="#n20171016X_here_documents">HERE documents</a> <i></i>  ( Oct 16, 2017 , <a target="_blank" href= "http://www.perlmeme.org/howtos/syntax/here_document.html">www.perlmeme.org</a> ) </li>
<li>20171014 : <a href="#n20171014X_in_december_18_2017_perl_turns_30">In December  18, 2017 Perl turns 30</a> <i> by <a target="_blank" href="https://opensource.com/users/druthb">Ruth Holloway</a></i>  ( Oct 14, 2017 , <a target="_blank" href="https://opensource.com/article/17/10/perl-turns-30">opensource.com</a> ) </li>
<li>20170927 : <a href="#n20170927X_qq_qw_qr_qx">qq       qw      qr      qx</a> <i></i>  ( <a target="_blank" href="http://crookedtimber.org/2017/09/02/restating-the-case-against-trickle-down/">crookedtimber.org</a> ) </li>
<li>20170918 : <a href="#n20170918X_the_fall_of_perl_the_webs_most_promising_language">The Fall Of Perl, The Webs Most Promising Language  </a> <i> by Conor Myhrvold </i>  ( Jan 13, 2014 , <a target="_blank" href="https://www.fastcompany.com/3026446/the-fall-of-perl-the-webs-most-promising-language"> www.fastcompany.com </a> ) </li>
<li>20170628 : <a href="#n20170628X_a_short_guide_to_dbi">A Short Guide  to DBI </a> <i></i>  ( Jun 18, 2017 , <a target="_blank" href="http://www.perl.com/pub/1999/10/DBI.html">www.perl.com </a> ) </li>
<li>20170628 : <a href="#n20170628X_bless_my_referents"> Bless My Referents </a> <i> by Damian Conway</i>  (  <abbr title="1999-09-16T00:00:00-08:00">September 16, 1999 </abbr> , <a target="_blank" href="http://www.perl.com/pub/1999/09/refererents.html">www.perl.com </a> ) </li>
<li>20170628 : <a href="#n20170628X_whats_wrong_with_sort_and_how_to_fix_it"> Whats Wrong with sort and How to Fix It </a> <i> by <a target="_blank" href="http://training.perl.com/">Tom Christiansen </a></i>  ( Aug 31, 2011 , <a target="_blank" href="http://www.perl.com/pub/2011/08/whats-wrong-with-sort-and-how-to-fix-it.html"> www.perl.com </a> ) </li>
<li>20170618 : <a href="#n20170618X_making_perl_reusable_with_modules">Making Perl  Reusable with Modules </a> <i></i>  ( Jun 18, 2017 , <a target="_blank" href="http://www.perl.com/pub/2007/08/09/making-perl-modules.html">www.perl.com </a>  ) </li>
<li>20170528 : <a href="#n20170528X_eliza_wikipedia">ELIZA - Wikipedia</a> <i></i>  ( <a target="_blank" href="https://en.wikipedia.org/wiki/ELIZA">ELIZA - Wikipedia</a>, May 28, 2017 ) </li>
<li>20170507 : <a href="#n20170507X_example_code_from_beginning_perl_for_bioinformatics">Example Code  from Beginning Perl for Bioinformatics </a> <i></i>  ( May 07, 2017 , <a target="_blank" href="http://uwf.edu/msutton/bsc4434/book-examples/">uwf.edu </a> ) </li>
<li>20170507 : <a href="#n20170507X_why_is_perl_used_so_extensively_in_biology_research"> Why is Perl used so extensively in biology research </a> <i></i>  ( Jan 15, 2016 , <a target="_blank" href="http://stackoverflow.com/questions/2527170/why-is-perl-used-so-extensively-in-biology-research"> stackoverflow.com </a> ) </li>
<li>20170507 : <a href="#n20170507X_a_useful_capability_of_perl_substr_function"> A useful capability of Perl substr function</a> <i></i>  ( <a target="_blank" href="http://www.softpanorama.org/Scripting/Perlorama/Functions/substr_function.shtml"> A useful capability of Perl substr function</a>, May 07, 2017 ) </li>
<li>20170320 : <a href="#n20170320X_cultured_perl_one_liners_102">Cultured Perl One-liners 102 </a> <i></i>  ( Mar 20, 2017 , <a target="_blank" href="https://www.ibm.com/developerworks/library/l-p102/">www.ibm.com</a> ) </li>
<li>20161227 : <a href="#n20161227__perl_is_a_great_choice_for_a_variety_of_industries">Perl is  a great choice for a variety of industries </a> <i></i>  ( Dec 27, 2016 , <a target="_blank" href="https://opensource.com/life/16/10/perl-continues-attract-new-users">opensource.com</a> ) </li>
<li>20161226 : <a href="#n20161226__perl_advent_calendar_enters_its_17th_year"> Perl Advent Calendar Enters Its 17th Year </a> <i></i>  ( Dec 26, 2016 , <a target="_blank" href="https://developers.slashdot.org/story/16/12/03/0342208/perl-advent-calendar-enters-its-17th-year"> developers.slashdot.org</a> ) </li>
<li>20151118 : <a href="#n20151118__beginning_perl"> Beginning Perl</a> <i></i>  ( Sept 19, 2012 , <a target="_blank" href="http://www.amazon.com/Beginning-Perl-Curtis-Poe/dp/1118013840/ref=sr_1_11?s=books&ie=UTF8&qid=1447904250&sr=1-11&keywords=Perl"> Amazon.com</a> ) </li>
<li>20151116 : <a href="#n20151116__undef_can_be_used_as_a_dummy_variable_in_split_function"> undef can be used as a dummy variable in split function</a> <i></i>  ( Nov 16, 2015 ) </li>
<li>20151115 : <a href="#n20151115__web_basics_with_lwp">Web  Basics with LWP </a> <i></i>  ( Aug 20, 2002 , <a target="_blank" href="http://www.perl.com/pub/2002/08/20/perlandlwp.html">Perl.com</a> ) </li>
<li>20151115 : <a href="#n20151115__unescaped_left_brace_in_regex_is_deprecated">Unescaped left brace in  regex is deprecated</a> <i></i>  ( <a target="_blank" href="http://www.perlmonks.org/?node_id=1135262">www.perlmonks.org</a> ) </li>
<li>20151115 : <a href="#n20151115__perl_lwp">Perl LWP</a> <i></i>  ( June 30, 2002 , <a target="_blank" href="http://www.amazon.com/Perl-LWP-Sean-M-Burke/dp/0596001789">Amazon.com</a> ) </li>
<li>20151101 : <a href="#n20151101__stupid_open_tricks">Stupid open()  tricks</a> <i></i>  ( <a target="_blank" href="http://perltricks.com/article/182/2015/7/15/Stupid-open---tricks">perltricks.com</a> ) </li>
<li>20151031 : <a href="#n20151031X_a_preview_of_perl_5_222">A preview of Perl 5.222</a> <i> by <a target="_blank" href="http://perltricks.com/article/165/2015/4/10/A-preview-of-Perl-5-22#2">brian d foy</a></i>  ( April 10, 2015 , <a target="_blank" href="http://perltricks.com/article/165/2015/4/10/A-preview-of-Perl-5-22">perltricks.com</a> ) </li>
<li>20151031 : <a href="#n20151031X_local">local($_)</a> <i></i>  ( <a target="_blank" href="http://perldoc.perl.org/functions/local.html">local($_)</a>, Oct 31, 2015 ) </li>
<li>20151006 : <a href="#n20151006X_larry_wall_unveils_perl_6_0_0">Larry  Wall Unveils Perl 6.0.0</a> <i></i>  ( October 06, 2015 , <a target="_blank" href="http://developers.slashdot.org/story/15/10/06/217239/larry-wall-unveils-perl-600"> developers.slashdot.org</a> ) </li>
<li>20151006 : <a href="#n20151006X_persistent_variables_via_state">Persistent variables via state()</a> <i></i>  ( <a target="_blank" href="http://perldoc.perl.org/perlsub.html">perlsub - perldoc.perl.org</a> ) </li>
<li>20150611 : <a href="#n20150611X_the_fall_of_perl_the_webs_most_promising_language">The  Fall Of Perl, The Webs Most Promising Language</a> <i> by <a target="_blank" href="http://www.fastcolabs.com/user/conor-myhrvold">Conor  Myhrvold</a></i>  ( <a target="_blank" href="http://www.fastcompany.com/3026446/the-fall-of-perl-the-webs-most-promising-language">Fast Company Business + Innovation</a> ) </li>
<li>20120228 : <a href="#n20120228X_perl_books_for_modern_perl_programming">Perl Books for modern Perl programming</a> <i> by Chromatic</i>  ( February 28, 2012  ) </li>
<li>20120118 : <a href="#n20120118X_i_am_looking_forward_to_learn_perl"> I am looking forward to learn perl </a> <i></i>  (  <a target="_blank" href="http://www.linkedin.com/groupItem?view=&gid=40830&type=member&item=86864725&commentID=65090523&goback=.gde_40830_member_87753681.gmp_40830&report.success=8ULbKyXO6NDvmoK7o030UNOYGZKrvdhBhypZ_w8EpQrrQI-BBjkmxwkEOwBjLE28YyDIxcyEO7_TA_giuRN#commentID_65090523"> LinkedIn</a> ) </li>
<li>20110727 : <a href="#n20110727X_pac">PAC </a> <i></i>  ( <a target="_blank" href="http://freshmeat.net/projects/pac">freshmeat.net</a> ) </li>
<li>20110318 : <a href="#n20110318X_new_perl_news_site_launches">New Perl  news site launches </a> <i> by Ranguard</i>  ( March 17, 2011 ) </li>
<li>20110317 : <a href="#n20110317X_stupid_quot_make_quot_tricks_workflow_control_with_quot_make_quot"> Stupid "make" Tricks: Workflow Control with "make"</a> <i> by Mark Leighton Fisher</i>  ( March 16, 2011 , <a target="_blank" href="http://blogs.perl.org/">blogs.perl.org</a> ) </li>
<li>20110216 : <a href="#n20110216X_perl_critic_freshmeat_net">Perl-Critic freshmeat.net</a> <i></i>  ( <a target="_blank" href="http://freshmeat.net/projects/perl-critic">Perl-Critic freshmeat.net</a>, Feb 16, 2011 ) </li>
<li>20110215 : <a href="#n20110215X_pac_2_5_5_4">PAC 2.5.5.4</a> <i></i>  ( <a target="_blank" href="http://freshmeat.net/projects/pac">PAC 2.5.5.4</a>, Feb 15, 2011 ) </li>
<li>20110121 : <a href="#n20110121X_which_language_is_best_for_system_admin_except_for_shell_linkedin"> Which language is best for system admin except for shell LinkedIn</a> <i></i>  ( <a target="_blank" href="http://www.linkedin.com/groups/which-language-is-best-system-49301.S.39809661?qid=659372ed-80ea-4691-95c9-29dfa1c36918&goback=.gmp_49301"> Which language is best for system admin except for shell LinkedIn</a>, Jan 21, 2011 ) </li>
<li>20110115 : <a href="#n20110115X_when">When</a> <i></i>  ( <a target="_blank" href="http://freshmeat.net/projects/when">When</a>, Jan 15, 2011 ) </li>
<li>20110114 : <a href="#n20110114X_brian_kernighan_random_thoughts_on_scripting_languages">Brian Kernighan  - Random thoughts on  scripting languages </a> <i></i>  ( <a target="_blank" href="http://www.eecs.harvard.edu/cs152/lectures/CS152-Lecture_14-Kernighan.pdf">Brian Kernighan  - Random thoughts on <i>scripting languages</i></a>, Jan 14, 2011 ) </li>
<li>20101225 : <a href="#n20101225X_23_years_of_culture_hacking_with_perl">23 Years  of Culture Hacking With Perl - </a> <i></i>  ( December 25 , <a target="_blank" href="http://developers.slashdot.org/story/10/12/24/1934221/23-Years-of-Culture-Hacking-With-Perl?from=rss">Slashdot</a> ) </li>
<li>20101225 : <a href="#n20101225X_day_24_yule_the_ancient_troll_tide_carol">Day  24 – Yule the Ancient Troll-tide Carol</a> <i></i>  ( <a target="_blank" href="http://perl6advent.wordpress.com/2010/12/24/day-24-yule-the-ancient-troll-tide-carol/">Perl 6 Advent Calendar</a> ) </li>
<li>20101220 : <a href="#n20101220X_what_hurts_you_the_most_in_perl"> What hurts you the most in Perl </a> <i></i>  (  <a target="_blank" href="http://www.linkedin.com/groupItem?view=&gid=40830&type=member&item=35978341&qid=7dfbdc69-04f6-445f-8f63-783950ef9054&goback=.gmp_40830"> LinkedIn</a> ) </li>
<li>20100610 : <a href="#n20100610X_deep_protocol_analysis_of_unix_networks"> Deep-protocol analysis of UNIX networks</a> <i></i>  ( Jun 08, 2010 , <a target="_blank" href="http://www.ibm.com/developerworks/">developerWorks</a> ) </li>
<li>20100610 : <a href="#n20100610X_ack_better_than_grep_a_power_search_tool_for_programmers">ack -- better than grep, a power search tool for programmers</a> <i></i>  ( <a target="_blank" href="http://betterthangrep.com/">ack -- better than grep, a power search tool for programmers</a>, Jun 10, 2010 ) </li>
<li>20100425 : <a href="#n20100425X_the_perl_review_archives">The Perl Review Archives</a> <i></i>  ( <a target="_blank" href="https://www.theperlreview.com/Issues/">The Perl Review Archives</a>, Apr 25, 2010 ) </li>
<li>20100425 : <a href="#n20100425X_what_perl_got_right_jan_03">What Perl got right (Jan 03)</a> <i></i>  ( <a target="_blank" href="http://www.stonehenge.com/merlyn/LinuxMag/col44.html">What Perl got right (Jan 03)</a>, Apr 25, 2010 ) </li>
<li>20100425 : <a href="#n20100425X_perl_programming_dtp_250">Perl  Programming (DTP-250)</a> <i></i>  ( <a target="_blank" href="http://education.oracle.com/pls/web_prod-plq-dad/show_desc.redirect?dc=D61834GC10&p_org_id=1001&lang=US">Perl  Programming (DTP-250)</a>, Apr 25, 2010 ) </li>
<li>20100424 : <a href="#n20100424X_free_perl_books_freeprogrammingresources_com">Free Perl Books - freeprogrammingresources.com</a> <i></i>  ( <a target="_blank" href="http://www.freeprogrammingresources.com/perlbook.html">Free Perl Books - freeprogrammingresources.com</a>, Apr 24, 2010 ) </li>
<li>20091108 : <a href="#n20091108X_perl_far_from_dead_more_popular_than_you_think">Perl  far from dead, more popular than you think </a> <i></i>  ( November 6, 2009 , <a target="_blank" href="http://royal.pingdom.com/2009/11/06/perl-far-from-dead-more-popular-than-you-think/">Royal Pingdom</a> ) </li>
<li>20090421 : <a href="#n20090421X_why_you_should_upgrade_to_perl_5_10"> Why you should upgrade to Perl 5.10</a> <i></i>  ( <a target="_blank" href="http://www.perlfoundation.org/perl5/index.cgi?action=display_html;page_name=why_you_should_upgrade_to_perl_5_10"> Why you should upgrade to Perl 5.10</a>, Apr 21, 2009 ) </li>
<li>20090421 : <a href="#n20090421X_first_look_perl_5_10_is_a_pearl_compiler_from_wired_com">First Look Perl 5.10 is a Pearl Compiler  from Wired.com</a> <i></i>  ( <a target="_blank" href="http://blog.wired.com/monkeybites/2008/01/first-look-perl.html">First Look Perl 5.10 is a Pearl Compiler  from Wired.com</a>,  ) </li>
<li>20090421 : <a href="#n20090421X_a_beginners_introduction_to_perl_5_10_part_three">A Beginners Introduction to Perl  5.10, part three </a> <i> by <a target="_blank" href="http://www.oreillynet.com/pub/au/176">chromatic</a></i>  ( June 26, 2008 , <a target="_blank" href="http://news.oreilly.com/2008/06/a-beginners-introduction-to-pe.html">O'Reilly News</a>  ) </li>
<li>20090421 : <a href="#n20090421X_perl_5_10_advanced_regular_expressions">Perl 5.10 Advanced Regular Expressions</a> <i></i>  ( <a target="_blank" href="http://www.regex-engineer.org/slides/perl510_regex.html">Perl 5.10 Advanced Regular Expressions</a>,  ) </li>
<li>20090421 : <a href="#n20090421X_regular_expressions_in_perl_5_10">Regular Expressions in Perl 5.10</a> <i></i>  ( <a target="_blank" href="http://www.szabgab.com/blog/2007/12/1198488988.html">Regular Expressions in Perl 5.10</a>,  ) </li>
<li>20090421 : <a href="#n20090421X_perldelta_what_is_new_for_perl_5_10_0_search_cpan_org">perldelta  - what is new for perl 5.10.0 - search.cpan.org</a> <i></i>  ( <a target="_blank" href="http://search.cpan.org/dist/perl-5.10.0/pod/perl5100delta.pod#Pseudo-hashes_have_been_removed">perldelta  - what is new for perl 5.10.0 - search.cpan.org</a>,  ) </li>
<li>20090225 : <a href="#n20090225X_perl_5_10_highlights">Perl 5.10 highlights</a> <i></i>  ( <a target="_blank" href="http://www.activestate.com/activeperl/features/">Perl 5.10 highlights</a>, Feb 25, 2009 ) </li>
<li>20081212 : <a href="#n20081212X_the_a_z_of_programming_languages_perl">The A-Z  of Programming Languages Perl</a> <i></i>  ( <a target="_blank" href="http://www.linuxtoday.com/news_story.php3?ltsn=2008-12-12-011-35-IN-CY-SW-0005">The A-Z  of Programming Languages Perl</a>, Dec 12, 2008 ) </li>
<li>20081107 : <a href="#n20081107X_perl_express_a_free_perl_ide_editor_for_windows">Perl Express A Free Perl IDE-Editor for Windows.</a> <i></i>  ( <a target="_blank" href="http://www.perl-express.com/">Perl Express A Free Perl IDE-Editor for Windows.</a>, Nov 7, 2008 ) </li>
<li>20080921 : <a href="#n20080921X_using_inline_in_perl">Using Inline in Perl</a> <i> by Michael Roberts (michael@vivtek.com), Owner, Vitek</i>  ( <a target="_blank" href="http://www.ibm.com/developerworks/linux/library/l-inline.html">Using Inline in Perl</a>, Sep 21, 2008 ) </li>
<li>20080506 : <a href="#n20080506X_ack_perl_based_grep_replacement">ack! - Perl-based  grep replacement</a> <i></i>  ( <a target="_blank" href="http://blog.i-no.de//archives/2008/05/06/index.html#e2008-05-06T16_44_51.txt">ack! - Perl-based  grep replacement</a>, May 06, 2008 ) </li>
<li>20080311 : <a href="#n20080311X_perl_tutorial_19_functions_lc_uc_lcfirst_ucfirst">Perl Tutorial 19: Functions lc, uc, lcfirst,  ucfirst</a> <i></i>  ( <a target="_blank" href="http://www.youtube.com/watch?v=PIyzRW7L6eY">Perl Tutorial 19: Functions lc, uc, lcfirst,  ucfirst</a>, Mar 11, 2008 ) </li>
<li>20080305 : <a href="#n20080305X_the_new_york_times_perl_profiler">The New York  Times Perl Profiler</a> <i> by <a target="_blank" href="http://open.blogs.nytimes.com/author/akaplan/">Adam Kaplan</a></i>  ( <a target="_blank" href="http://open.blogs.nytimes.com/2008/03/05/the-new-york-times-perl-profiler/">The New York  Times Perl Profiler</a>, Mar 5, 2008 ) </li>
<li>20080221 : <a href="#n20080221X_free_perl_books_freeprogrammingresources_com">Free Perl Books - freeprogrammingresources.com</a> <i></i>  ( <a target="_blank" href="http://www.freeprogrammingresources.com/perlbook.html">Free Perl Books - freeprogrammingresources.com</a>, Feb 21, 2008 ) </li>
<li>20080106 : <a href="#n20080106X_freshmeat_net_project_details_for_wendy_site_engine">freshmeat.net Project  details for Wendy Site Engine</a> <i></i>  ( <a target="_blank" href="http://freshmeat.net/projects/wendy/?branch_id=72862&release_id=269151">freshmeat.net Project  details for Wendy Site Engine</a>, Jan 6, 2008 ) </li>
<li>20071219 : <a href="#n20071219X_no_comments">No Comments</a> <i></i>  ( <a target="_blank" href="http://mamchenkov.net/wordpress/2007/12/19/happy-birthday-perl/#respond">No Comments</a>, Dec 19, 2007 ) </li>
<li>20071219 : <a href="#n20071219X_freshmeat_net_project_details_for_pixconv_pl">freshmeat.net Project details  for pixconv.pl</a> <i></i>  ( <a target="_blank" href="http://freshmeat.net/projects/pixconv/?branch_id=46798&release_id=268563">freshmeat.net Project details  for pixconv.pl</a>,  ) </li>
<li>20071219 : <a href="#n20071219X_perl_resource_center_perl_ebooks">Perl Resource  Center Perl eBooks</a> <i></i>  ( <a target="_blank" href="http://www.deitel.com/ResourceCenters/Programming/Perl/PerleBooks/tabid/827/Default.aspx">Perl Resource  Center Perl eBooks</a>,  ) </li>
<li>20071217 : <a href="#n20071217X_kazi_1_0">Kazi 1.0 </a> <i> by <a target="_blank" href="http://freshmeat.net/~anovalskunk/">Luka Novsak </a></i>  ( <a target="_blank" href="http://freshmeat.net/releases/267837/">Kazi 1.0 </a>, Dec 17, 2007 ) </li>
<li>20071209 : <a href="#n20071209X_freshmeat_net_project_details_for_host_grapher">freshmeat.net Project details for Host Grapher</a> <i></i>  ( <a target="_blank" href="http://freshmeat.net/projects/hgrapher/">freshmeat.net Project details for Host Grapher</a>, Dec 9, 2007 ) </li>
<li>20071207 : <a href="#n20071207X_freshmeat_net_project_details_for_perltidy">freshmeat.net  Project details for perltidy</a> <i></i>  ( <a target="_blank" href="http://freshmeat.net/projects/perltidy/?branch_id=13061&release_id=267187">freshmeat.net  Project details for perltidy</a>, Dec 7, 2007 ) </li>
<li>20071207 : <a href="#n20071207X_freshmeat_net_project_details_for_xhtml_family_tree_generator">freshmeat.net  Project details for XHTML Family Tree Generator</a> <i></i>  ( <a target="_blank" href="http://freshmeat.net/projects/familytree_cgi/?branch_id=15581&release_id=267267">freshmeat.net  Project details for XHTML Family Tree Generator</a>, Dec 7, 2007 ) </li>
<li>20071206 : <a href="#n20071206X_freshmeat_net_project_details_for_sman">freshmeat.net Project  details for Sman</a> <i></i>  ( <a target="_blank" href="http://freshmeat.net/projects/sman/?branch_id=59978&release_id=267257">freshmeat.net Project  details for Sman</a>, Dec 6, 2007 ) </li>
<li>20071202 : <a href="#n20071202X_freshmeat_net_project_details_for_podbrowser">freshmeat.net  Project details for PodBrowser</a> <i></i>  ( <a target="_blank" href="http://freshmeat.net/projects/podbrowser/?branch_id=52935&release_id=266897">freshmeat.net  Project details for PodBrowser</a>, Dec 2, 2007 ) </li>
<li>20071201 : <a href="#n20071201X_freshmeat_net_project_details_for_configgeneral">freshmeat.net  Project details for ConfigGeneral</a> <i></i>  ( <a target="_blank" href="http://freshmeat.net/projects/configgeneral/?branch_id=15044&release_id=266848">freshmeat.net  Project details for ConfigGeneral</a>, Dec 1, 2007 ) </li>
<li>20071130 : <a href="#n20071130X_bbc_radio_labs_perl_on_rails">BBC - Radio Labs - Perl  on Rails</a> <i> by Tom Scott </i>  ( <a target="_blank" href="http://www.bbc.co.uk/blogs/radiolabs/2007/11/perl_on_rails.shtml">BBC - Radio Labs - Perl  on Rails</a>, Nov 30, 2007 ) </li>
<li>20071027 : <a href="#n20071027X_unix_system_administration_tools">UNIX System Administration Tools</a> <i></i>  ( <a target="_blank" href="http://www.occam.com/tools/">UNIX System Administration Tools</a>, Oct 27, 2007 ) </li>
<li>20071027 : <a href="#n20071027X_unix_system_administration_tools">UNIX System Administration Tools</a> <i></i>  ( <a target="_blank" href="http://www.occam.com/tools/">UNIX System Administration Tools</a>, Oct 27, 2007 ) </li>
<li>20070906 : <a href="#n20070906X_komodo_spawns_new_open_source_ide_project">Komodo Spawns New Open Source IDE  Project</a> <i></i>  ( <a target="_blank" href="http://www.internetnews.com/dev-news/article.php/3698001">Komodo Spawns New Open Source IDE  Project</a>, Sep 6, 2007 ) </li>
<li>20070906 : <a href="#n20070906X_picking_up_perl">Picking Up Perl</a> <i> by Bradley M. Kuhn</i>  ( <a target="_blank" href="http://www.ebb.org/PickingUpPerl/pickingUpPerl.pdf">Picking Up Perl</a>,  ) </li>
<li>20070712 : <a href="#n20070712X_minimal_perl">  Minimal Perl </a> <i></i>  ( <a target="_blank" href="http://minimalperl.com/"> <b>Minimal Perl</b></a>, Jul 12, 2007 ) </li>
<li>20070503 : <a href="#n20070503X_python_tcl_and_perl_oh_my_was_re_tcl_vs_perl_comp_lang_perl_tk_google_groups">Python, Tcl and Perl,  oh my! (was Re tcl vs. perl) - comp.lang.perl.tk Google Groups</a> <i></i>  ( <a target="_blank" href="http://groups.google.com/group/comp.lang.perl.tk/msg/a371b49a9276332">Python, Tcl and Perl,  oh my! (was Re tcl vs. perl) - comp.lang.perl.tk Google Groups</a>, May 3, 2007 ) </li>
<li>20070428 : <a href="#n20070428X_freshmeat_net_project_details_for_docperl">freshmeat.net  Project details for DocPerl</a> <i></i>  ( <a target="_blank" href="http://freshmeat.net/projects/docperl/?branch_id=64813&release_id=252483">freshmeat.net  Project details for DocPerl</a>, Apr 28, 2007 ) </li>
<li>20070326 : <a href="#n20070326X_freshmeat_net_project_details_for_perl_dev_kit">freshmeat.net Project  details for Perl Dev Kit</a> <i></i>  ( <a target="_blank" href="http://freshmeat.net/projects/pdk/?branch_id=68976&release_id=250092">freshmeat.net Project  details for Perl Dev Kit</a>, Mar 26, 2007 ) </li>
<li>20070313 : <a href="#n20070313X_programming_in_perl_debugging">Programming in Perl - Debugging</a> <i></i>  ( <a target="_blank" href="http://cgi2.cs.rpi.edu/~lallip/perl/fall05/debugging.shtml">Programming in Perl - Debugging</a>, Mar 13, 2007 ) </li>
<li>20070311 : <a href="#n20070311X_sys_admin_v16_i03_the_replacements">Sys Admin v16, i03 The Replacements</a> <i></i>  ( <a target="_blank" href="http://www.samag.com/documents/s=10118/sam0703i/0703i.htm">Sys Admin v16, i03 The Replacements</a>, Mar 11, 2007 ) </li>
<li>20070223 : <a href="#n20070223X_submitted_tech_tip_how_to_send_email_without_using_sendmail">Submitted Tech Tip How to Send  Email Without Using sendmail</a> <i> by <i>Ross Moffatt</i></i>  ( <a target="_blank" href="http://www.sun.com/bigadmin/content/submitted/send_email.jsp">BigAdmin </a> ) </li>
<li>20070220 : <a href="#n20070220X_dakshina_s_blog_weblog">Dakshina`s Blog  Weblog</a> <i></i>  ( <a target="_blank" href="http://blogs.sun.com/dakshina/entry/cgi/perl_script_for_uploading_files">Dakshina`s Blog  Weblog</a>, Feb 20, 2007 ) </li>
<li>20070220 : <a href="#n20070220X_manning_data_munging_with_perl">Manning Data Munging with Perl</a> <i></i>  ( <a target="_blank" href="http://www.manning.com/cross/">Manning Data Munging with Perl</a>,  ) </li>
<li>20070220 : <a href="#n20070220X_how_to_write_slow_algorithms_quickly_in_perl_playing_chomp">How to write slow algorithms quickly in Perl (Playing Chomp)</a> <i></i>  ( <a target="_blank" href="http://www.pti.co.il/talks/YAPCChomp.html">How to write slow algorithms quickly in Perl (Playing Chomp)</a>,  ) </li>
<li>20060410 : <a href="#n20060410X_log4perl_log4j_for_perl">log4perl - log4j for Perl</a> <i></i>  ( <a target="_blank" href="http://log4perl.sourceforge.net/">sourceforge.net</a>  ) </li>
<li>20060325 : <a href="#n20060325X_beginning_perl">Beginning Perl </a> <i></i>  ( <a target="_blank" href="http://www.perl.org/books/beginning-perl/">Beginning Perl </a>, Mar 25, 2006 ) </li>
<li>20060324 : <a href="#n20060324X_project_details_for_perl_linux">Project details for Perl-Linux</a> <i></i>  ( <a target="_blank" href="http://freshmeat.net/projects/perllinux/">freshmeat.net</a> ) </li>
<li>20060324 : <a href="#n20060324X_project_details_for_ryans_in_out_board">Project details  for Ryans In-Out Board</a> <i></i>  ( <a target="_blank" href="http://freshmeat.net/projects/ryansiob/?branch_id=17347&release_id=223275">freshmeat.net</a> ) </li>
<li>20060324 : <a href="#n20060324X_project_details_for_otl">Project details for  otl</a> <i></i>  ( <a target="_blank" href="http://freshmeat.net/projects/otl/?branch_id=57247&release_id=223283">freshmeat.net </a> ) </li>
<li>20060228 : <a href="#n20060228X_visual_python_python_and_visual_perl_perl_integrate_with_visual_studio_2005"> Visual Python (Python), and Visual Perl (Perl) integrate with Visual Studio 2005 </a> <i></i>  ( Feb 28, 2006 ) </li>
<li>20060214 : <a href="#n20060214X_logic_programming_with_perl_and_prolog">Logic Programming with Perl and Prolog</a> <i></i>  ( <a target="_blank" href="http://www.perl.com/pub/a/2005/12/15/perl_prolog.html">Logic Programming with Perl and Prolog</a>, Feb 14, 2006 ) </li>
<li>20060214 : <a href="#n20060214X_analyzing_html_with_perl">Analyzing HTML with Perl</a> <i></i>  ( <a target="_blank" href="http://www.perl.com/pub/a/2006/01/19/analyzing_html.html">Analyzing HTML with Perl</a>, Feb 14, 2006 ) </li>
<li>20060214 : <a href="#n20060214X_acky_net_tutorials_perl">Acky.net Tutorials Perl</a> <i></i>  ( <a target="_blank" href="http://www.acky.net/tutorials/perl/methods/index2.html">Acky.net Tutorials Perl</a>,  ) </li>
<li>20060214 : <a href="#n20060214X_interview_with_tim_maher_of_consultix">Interview with Tim Maher of Consultix</a> <i></i>  ( <a target="_blank" href="http://www.consultix-inc.com/consultix/interviews/tmp_com_interview.html">TeachMePerl.Com </a> ) </li>
<li>20050701 : <a href="#n20050701X_oreilly_is_perl_still_relevant">OReilly Is Perl Still  Relevant</a> <i></i>  ( <a target="_blank" href="http://archive.oreilly.com/pub/a/oreilly/ask_tim/2004/perl_0707.html">O'Reilly Is Perl Still  Relevant</a>, July 1, 2005 ) </li>
</ul>
<h2><a name="News">Old News</a> ;-) </h2>

<center><table border="0" width="100"><tr>
<td align="center"><a href="#NEWS_TOC"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191201X_how_can_i_export_all_subs_in_a_perl_package" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191201X_function_how_can_i_export_all_subs_in_a_perl_package_stack_overflow"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Dec 01, 2019] <a target="_blank" href="https://stackoverflow.com/questions/732133/how-can-i-export-all-subs-in-a-perl-package">How can   I export all subs in a Perl package?</a></h4>

<blockquote>
<h6>Jan 01, 2009 |  <a target="_blank" href= "https://stackoverflow.com/questions/732133/how-can-i-export-all-subs-in-a-perl-package">stackoverflow.com</a></h6>
 

    <p><a target="_blank" href="https://stackoverflow.com/questions/ask">Ask Question</a> Asked 10
    years, 7 months ago Active <a target="_blank" href=
    "https://stackoverflow.com/questions/732133/how-can-i-export-all-subs-in-a-perl-package?lastactivity">
    3 years, 5 months ago</a> Viewed 18k times</p>
    <hr noshade align="left" width="10" size="10">

    <p><b>Ville M</b> ,</p>

    <blockquote>
      I would like to expose all subs into my namespace without having to list them one at a time:
      <pre>
@EXPORT = qw( firstsub secondsub third sub etc );
</pre>

      <p>Using fully qualified names would require bunch of change to existing code so I'd rather
      not do that.</p>

      <p>Is there @EXPORT_ALL?</p>

      <p>I think documentation says it's a bad idea, but I'd like to do it anyway, or at least know
      how.</p>

      <p>To answer Jon's why: right now for quick refactoring I want to move of bunch of subs into
      their own package with least hassle and code changes to the existing scripts (where those
      subs are currenty used and often repeated).</p>

      <p>Also, mostly, I was just curious. (since it seemed like that Exporter might as well have
      that as standard feature, but somewhat surprisingly based on answers so far it doesn't)</p>
    </blockquote>

    <p><b>brian d foy</b> , 2009-04-08 23:58:35</p>

    <blockquote>
      Don't do any exporting at all, and don't declare a package name in your library. Just load
      the file with <code>require</code> and everything will be in the current package. Easy peasy.
    </blockquote>

    <p><b>Michael Carman</b> , 2009-04-09 00:15:10</p>

    <blockquote>
      Don't. But if you really want to... write a custom <code>import</code> that walks the symbol
      table and export all the named subroutines.
      <pre>
# Export all subs in package. Not for use in production code!
sub import {
    no strict 'refs';

    my $caller = caller;

    while (my ($name, $symbol) = each %{__PACKAGE__ . '::'}) {
        next if      $name eq 'BEGIN';   # don't export BEGIN blocks
        next if      $name eq 'import';  # don't export this sub
        next unless *{$symbol}{CODE};    # export subs only

        my $imported = $caller . '::' . $name;
        *{ $imported } = \*{ $symbol };
    }
}
</pre>
    </blockquote>

    <p><b>Chas. Owens</b> ,</p>

    <blockquote>
      Warning, the code following is as bad an idea as exporting everything:
      <pre>
package Expo;

use base "Exporter";

seek DATA, 0, 0; #move DATA back to package

#read this file looking for sub names
our @EXPORT = map { /^sub\s+([^({\s]+)/ ? $1 : () } <DATA>;

my $sub = sub {}; #make sure anon funcs aren't grabbed

sub foo($) {
    print shift, "\n";
}

sub bar ($) {
    print shift, "\n";
}

sub baz{
    print shift,"\n";
}

sub quux {
    print shift,"\n";
}

1;

__DATA__
</pre>

      <p>Here is the some code that uses the module:</p>
      <pre>
#!/usr/bin/perl

use strict;
use warnings;

use Expo;

print map { "[$_]\n" } @Expo::EXPORT;

foo("foo");
bar("bar");
baz("baz");
quux("quux");
</pre>

      <p>And here is its output:</p>
      <pre>
[foo]
[bar]
[baz]
[quux]
foo
bar
baz
quux
</pre>
    </blockquote>

    <p><b>Jon Ericson</b> , 2009-04-08 22:33:36</p>

    <blockquote>
      You can always call subroutines in there fully-specified form:
      <pre>
MyModule::firstsub();
</pre>

      <p>For modules I write internally, I find this convention works fairly well. It's a bit more
      typing, but tends to be better documentation.</p>

      <p>Take a look at <code>perldoc perlmod</code> for more information about what you are trying
      to accomplish.</p>

      <p>More generally, you could look at <code>Exporter</code> 's code and see how it uses glob
      aliasing. Or you can examine your module's namespace and export each subroutine. (I don't
      care to search for how to do that at the moment, but Perl makes this fairly easy.) Or you
      could just stick your subroutines in the <code>main</code> package:</p>
      <pre>
 package main;
 sub firstsub() { ... }
</pre>

      <p>(I don't think that's a good idea, but you know better than I do what you are trying to
      accomplish.)</p>

      <p>There's nothing wrong with doing this provided you know what you are doing and aren't just
      trying to avoid thinking about your interface to the outside world.</p>
    </blockquote>

    <p><b>ysth</b> , 2009-04-09 01:29:04</p>

    <blockquote>
      Perhaps you would be interested in one of the Export* modules on CPAN that lets you mark subs
      as exportable simply by adding an attribute to the sub definition? (Don't remember which one
      it was, though.)
    </blockquote>

    <p><b>echo</b> , 2014-10-11 18:23:01</p>

    <blockquote>
      <a target="_blank" href=
      "https://metacpan.org/pod/Exporter::Auto">https://metacpan.org/pod/Exporter::Auto</a>

      <p>Exporter::Auto. this is all you need.</p>
    </blockquote>

    <p><b>Tero Niemi</b> , 2013-04-02 00:32:25</p>

    <blockquote>
      Although it is not usually wise to dump all <code>sub</code> s from module into the caller
      namespace, it is sometimes useful (and more DRY!) to automatically generate
      <code>@EXPORT_OK</code> and <code>%EXPORT_TAGS</code> variables.

      <p>The easiest method is to extend the Exporter. A simple example is something like this:</p>
      <pre>
package Exporter::AutoOkay;
#
#   Automatically add all subroutines from caller package into the
#   @EXPORT_OK array. In the package use like Exporter, f.ex.:
#
#       use parent 'Exporter::AutoOkay';
#
use warnings;
use strict;
no strict 'refs';

require Exporter;

sub import {
    my $package = $_[0].'::';

    # Get the list of exportable items
    my @export_ok = (@{$package.'EXPORT_OK'});

    # Automatically add all subroutines from package into the list
    foreach (keys %{$package}) {
        next unless defined &{$package.$_};
        push @export_ok, $_;
    }

    # Set variable ready for Exporter
    @{$package.'EXPORT_OK'} = @export_ok;

    # Let Exporter do the rest
    goto &Exporter::import;
}

1;
</pre>

      <p>Note the use of <code>goto</code> that removes us from the caller stack.</p>

      <p>A more complete example can be found here: <a target="_blank" href=
      "http://pastebin.com/Z1QWzcpZ">http://pastebin.com/Z1QWzcpZ</a> It automatically generates
      tag groups from subroutine prefixes.</p>
    </blockquote>

    <p><b>Sérgio</b> , 2013-11-14 21:38:06</p>

    <blockquote>
      <b>case 1</b>

      <p>Library is :</p>
      <pre>
package mycommon;

use strict;
use warnings;

sub onefunctionthatyoumadeonlibary() {
}
1;
</pre>

      <p>you can use it, calling common:: :</p>
      <pre>
#!/usr/bin/perl
use strict;
use warnings;
use mycommon;

common::onefunctionthatyoumadeonlibary()
</pre><b>case 2</b>

      <p>Library is , yousimple export them :</p>
      <pre>
package mycommon;

use strict;
use warnings;

use base 'Exporter';

our @EXPORT = qw(onefunctionthatyoumadeonlibary);
sub onefunctionthatyoumadeonlibary() {
}
1;
</pre>

      <p>use it in same "namespace":</p>
      <pre>
#!/usr/bin/perl
use strict;
use warnings;
use mycommon qw(onefunctionthatyoumadeonlibary);

onefunctionthatyoumadeonlibary()
</pre>

      <p>Also we can do a mix of this two cases , we can export more common functions to use it
      without calling the packages name and other functions that we only call it with package name
      and that ones don't need to be exported.</p>
    </blockquote>

    <p><b>></b> ,</p>

    <blockquote>
      You will have to do some typeglob munging. I describe something similar here:

      <p><a target="_blank" href=
      "https://stackoverflow.com/questions/437785/is-there-a-way-to-use-a-single-file-that-in-turn-uses-multiple-others-in-perl/437835#437835">
      Is there a way to "use" a single file that in turn uses multiple others in Perl?</a></p>

      <p>The import routine there should do exactly what you want -- just don't import any symbols
      into your own namespace.</p>
    </blockquote>

    <p><b>Ville M</b> ,</p>

    <blockquote>
      I would like to expose all subs into my namespace without having to list them one at a time:
      <pre>
@EXPORT = qw( firstsub secondsub third sub etc );
</pre>

      <p>Using fully qualified names would require bunch of change to existing code so I'd rather
      not do that.</p>

      <p>Is there @EXPORT_ALL?</p>

      <p>I think documentation says it's a bad idea, but I'd like to do it anyway, or at least know
      how.</p>

      <p>To answer Jon's why: right now for quick refactoring I want to move of bunch of subs into
      their own package with least hassle and code changes to the existing scripts (where those
      subs are currenty used and often repeated).</p>

      <p>Also, mostly, I was just curious. (since it seemed like that Exporter might as well have
      that as standard feature, but somewhat surprisingly based on answers so far it doesn't)</p>
    </blockquote>

    <p><b>brian d foy</b> , 2009-04-08 23:58:35</p>

    <blockquote>
      Don't do any exporting at all, and don't declare a package name in your library. Just load
      the file with <code>require</code> and everything will be in the current package. Easy peasy.
    </blockquote>

    <p><b>Michael Carman</b> , 2009-04-09 00:15:10</p>

    <blockquote>
      Don't. But if you really want to... write a custom <code>import</code> that walks the symbol
      table and export all the named subroutines.
      <pre>
# Export all subs in package. Not for use in production code!
sub import {
    no strict 'refs';

    my $caller = caller;

    while (my ($name, $symbol) = each %{__PACKAGE__ . '::'}) {
        next if      $name eq 'BEGIN';   # don't export BEGIN blocks
        next if      $name eq 'import';  # don't export this sub
        next unless *{$symbol}{CODE};    # export subs only

        my $imported = $caller . '::' . $name;
        *{ $imported } = \*{ $symbol };
    }
}
</pre>
    </blockquote>

    <p><b>Chas. Owens</b> ,</p>

    <blockquote>
      Warning, the code following is as bad an idea as exporting everything:
      <pre>
package Expo;

use base "Exporter";

seek DATA, 0, 0; #move DATA back to package

#read this file looking for sub names
our @EXPORT = map { /^sub\s+([^({\s]+)/ ? $1 : () } <DATA>;

my $sub = sub {}; #make sure anon funcs aren't grabbed

sub foo($) {
    print shift, "\n";
}

sub bar ($) {
    print shift, "\n";
}

sub baz{
    print shift,"\n";
}

sub quux {
    print shift,"\n";
}

1;

__DATA__
</pre>

      <p>Here is the some code that uses the module:</p>
      <pre>
#!/usr/bin/perl

use strict;
use warnings;

use Expo;

print map { "[$_]\n" } @Expo::EXPORT;

foo("foo");
bar("bar");
baz("baz");
quux("quux");
</pre>

      <p>And here is its output:</p>
      <pre>
[foo]
[bar]
[baz]
[quux]
foo
bar
baz
quux
</pre>
    </blockquote>

    <p><b>Jon Ericson</b> , 2009-04-08 22:33:36</p>

    <blockquote>
      You can always call subroutines in there fully-specified form:
      <pre>
MyModule::firstsub();
</pre>

      <p>For modules I write internally, I find this convention works fairly well. It's a bit more
      typing, but tends to be better documentation.</p>

      <p>Take a look at <code>perldoc perlmod</code> for more information about what you are trying
      to accomplish.</p>

      <p>More generally, you could look at <code>Exporter</code> 's code and see how it uses glob
      aliasing. Or you can examine your module's namespace and export each subroutine. (I don't
      care to search for how to do that at the moment, but Perl makes this fairly easy.) Or you
      could just stick your subroutines in the <code>main</code> package:</p>
      <pre>
 package main;
 sub firstsub() { ... }
</pre>

      <p>(I don't think that's a good idea, but you know better than I do what you are trying to
      accomplish.)</p>

      <p>There's nothing wrong with doing this provided you know what you are doing and aren't just
      trying to avoid thinking about your interface to the outside world.</p>
    </blockquote>

    <p><b>ysth</b> , 2009-04-09 01:29:04</p>

    <blockquote>
      Perhaps you would be interested in one of the Export* modules on CPAN that lets you mark subs
      as exportable simply by adding an attribute to the sub definition? (Don't remember which one
      it was, though.)
    </blockquote>

    <p><b>echo</b> , 2014-10-11 18:23:01</p>

    <blockquote>
      <a target="_blank" href=
      "https://metacpan.org/pod/Exporter::Auto">https://metacpan.org/pod/Exporter::Auto</a>

      <p>Exporter::Auto. this is all you need.</p>
    </blockquote>

    <p><b>Tero Niemi</b> , 2013-04-02 00:32:25</p>

    <blockquote>
      Although it is not usually wise to dump all <code>sub</code> s from module into the caller
      namespace, it is sometimes useful (and more DRY!) to automatically generate
      <code>@EXPORT_OK</code> and <code>%EXPORT_TAGS</code> variables.

      <p>The easiest method is to extend the Exporter. A simple example is something like this:</p>
      <pre>
package Exporter::AutoOkay;
#
#   Automatically add all subroutines from caller package into the
#   @EXPORT_OK array. In the package use like Exporter, f.ex.:
#
#       use parent 'Exporter::AutoOkay';
#
use warnings;
use strict;
no strict 'refs';

require Exporter;

sub import {
    my $package = $_[0].'::';

    # Get the list of exportable items
    my @export_ok = (@{$package.'EXPORT_OK'});

    # Automatically add all subroutines from package into the list
    foreach (keys %{$package}) {
        next unless defined &{$package.$_};
        push @export_ok, $_;
    }

    # Set variable ready for Exporter
    @{$package.'EXPORT_OK'} = @export_ok;

    # Let Exporter do the rest
    goto &Exporter::import;
}

1;
</pre>

      <p>Note the use of <code>goto</code> that removes us from the caller stack.</p>

      <p>A more complete example can be found here: <a target="_blank" href=
      "http://pastebin.com/Z1QWzcpZ">http://pastebin.com/Z1QWzcpZ</a> It automatically generates
      tag groups from subroutine prefixes.</p>
    </blockquote>

    <p><b>Sérgio</b> , 2013-11-14 21:38:06</p>

    <blockquote>
      <b>case 1</b>

      <p>Library is :</p>
      <pre>
package mycommon;

use strict;
use warnings;

sub onefunctionthatyoumadeonlibary() {
}
1;
</pre>

      <p>you can use it, calling common:: :</p>
      <pre>
#!/usr/bin/perl
use strict;
use warnings;
use mycommon;

common::onefunctionthatyoumadeonlibary()
</pre><b>case 2</b>

      <p>Library is , yousimple export them :</p>
      <pre>
package mycommon;

use strict;
use warnings;

use base 'Exporter';

our @EXPORT = qw(onefunctionthatyoumadeonlibary);
sub onefunctionthatyoumadeonlibary() {
}
1;
</pre>

      <p>use it in same "namespace":</p>
      <pre>
#!/usr/bin/perl
use strict;
use warnings;
use mycommon qw(onefunctionthatyoumadeonlibary);

onefunctionthatyoumadeonlibary()
</pre>

      <p>Also we can do a mix of this two cases , we can export more common functions to use it
      without calling the packages name and other functions that we only call it with package name
      and that ones don't need to be exported.</p>
    </blockquote>

    <p><b>></b> ,</p>

    <blockquote>
      You will have to do some typeglob munging. I describe something similar here:

      <p><a target="_blank" href=
      "https://stackoverflow.com/questions/437785/is-there-a-way-to-use-a-single-file-that-in-turn-uses-multiple-others-in-perl/437835#437835">
      Is there a way to "use" a single file that in turn uses multiple others in Perl?</a></p>

      <p>The import routine there should do exactly what you want -- just don't import any symbols
      into your own namespace.</p>
    </blockquote>

    <p><b>Ville M</b> ,</p>

    <blockquote>
      I would like to expose all subs into my namespace without having to list them one at a time:
      <pre>
@EXPORT = qw( firstsub secondsub third sub etc );
</pre>

      <p>Using fully qualified names would require bunch of change to existing code so I'd rather
      not do that.</p>

      <p>Is there @EXPORT_ALL?</p>

      <p>I think documentation says it's a bad idea, but I'd like to do it anyway, or at least know
      how.</p>

      <p>To answer Jon's why: right now for quick refactoring I want to move of bunch of subs into
      their own package with least hassle and code changes to the existing scripts (where those
      subs are currenty used and often repeated).</p>

      <p>Also, mostly, I was just curious. (since it seemed like that Exporter might as well have
      that as standard feature, but somewhat surprisingly based on answers so far it doesn't)</p>
    </blockquote>

    <p><b>brian d foy</b> , 2009-04-08 23:58:35</p>

    <blockquote>
      Don't do any exporting at all, and don't declare a package name in your library. Just load
      the file with <code>require</code> and everything will be in the current package. Easy peasy.
    </blockquote>

    <p><b>Michael Carman</b> , 2009-04-09 00:15:10</p>

    <blockquote>
      Don't. But if you really want to... write a custom <code>import</code> that walks the symbol
      table and export all the named subroutines.
      <pre>
# Export all subs in package. Not for use in production code!
sub import {
    no strict 'refs';

    my $caller = caller;

    while (my ($name, $symbol) = each %{__PACKAGE__ . '::'}) {
        next if      $name eq 'BEGIN';   # don't export BEGIN blocks
        next if      $name eq 'import';  # don't export this sub
        next unless *{$symbol}{CODE};    # export subs only

        my $imported = $caller . '::' . $name;
        *{ $imported } = \*{ $symbol };
    }
}
</pre>
    </blockquote>

    <p><b>Chas. Owens</b> ,</p>

    <blockquote>
      Warning, the code following is as bad an idea as exporting everything:
      <pre>
package Expo;

use base "Exporter";

seek DATA, 0, 0; #move DATA back to package

#read this file looking for sub names
our @EXPORT = map { /^sub\s+([^({\s]+)/ ? $1 : () } <DATA>;

my $sub = sub {}; #make sure anon funcs aren't grabbed

sub foo($) {
    print shift, "\n";
}

sub bar ($) {
    print shift, "\n";
}

sub baz{
    print shift,"\n";
}

sub quux {
    print shift,"\n";
}

1;

__DATA__
</pre>

      <p>Here is the some code that uses the module:</p>
      <pre>
#!/usr/bin/perl

use strict;
use warnings;

use Expo;

print map { "[$_]\n" } @Expo::EXPORT;

foo("foo");
bar("bar");
baz("baz");
quux("quux");
</pre>

      <p>And here is its output:</p>
      <pre>
[foo]
[bar]
[baz]
[quux]
foo
bar
baz
quux
</pre>
    </blockquote>

    <p><b>Jon Ericson</b> , 2009-04-08 22:33:36</p>

    <blockquote>
      You can always call subroutines in there fully-specified form:
      <pre>
MyModule::firstsub();
</pre>

      <p>For modules I write internally, I find this convention works fairly well. It's a bit more
      typing, but tends to be better documentation.</p>

      <p>Take a look at <code>perldoc perlmod</code> for more information about what you are trying
      to accomplish.</p>

      <p>More generally, you could look at <code>Exporter</code> 's code and see how it uses glob
      aliasing. Or you can examine your module's namespace and export each subroutine. (I don't
      care to search for how to do that at the moment, but Perl makes this fairly easy.) Or you
      could just stick your subroutines in the <code>main</code> package:</p>
      <pre>
 package main;
 sub firstsub() { ... }
</pre>

      <p>(I don't think that's a good idea, but you know better than I do what you are trying to
      accomplish.)</p>

      <p>There's nothing wrong with doing this provided you know what you are doing and aren't just
      trying to avoid thinking about your interface to the outside world.</p>
    </blockquote>

    <p><b>ysth</b> , 2009-04-09 01:29:04</p>

    <blockquote>
      Perhaps you would be interested in one of the Export* modules on CPAN that lets you mark subs
      as exportable simply by adding an attribute to the sub definition? (Don't remember which one
      it was, though.)
    </blockquote>

    <p><b>echo</b> , 2014-10-11 18:23:01</p>

    <blockquote>
      <a target="_blank" href=
      "https://metacpan.org/pod/Exporter::Auto">https://metacpan.org/pod/Exporter::Auto</a>

      <p>Exporter::Auto. this is all you need.</p>
    </blockquote>

    <p><b>Tero Niemi</b> , 2013-04-02 00:32:25</p>

    <blockquote>
      Although it is not usually wise to dump all <code>sub</code> s from module into the caller
      namespace, it is sometimes useful (and more DRY!) to automatically generate
      <code>@EXPORT_OK</code> and <code>%EXPORT_TAGS</code> variables.

      <p>The easiest method is to extend the Exporter. A simple example is something like this:</p>
      <pre>
package Exporter::AutoOkay;
#
#   Automatically add all subroutines from caller package into the
#   @EXPORT_OK array. In the package use like Exporter, f.ex.:
#
#       use parent 'Exporter::AutoOkay';
#
use warnings;
use strict;
no strict 'refs';

require Exporter;

sub import {
    my $package = $_[0].'::';

    # Get the list of exportable items
    my @export_ok = (@{$package.'EXPORT_OK'});

    # Automatically add all subroutines from package into the list
    foreach (keys %{$package}) {
        next unless defined &{$package.$_};
        push @export_ok, $_;
    }

    # Set variable ready for Exporter
    @{$package.'EXPORT_OK'} = @export_ok;

    # Let Exporter do the rest
    goto &Exporter::import;
}

1;
</pre>

      <p>Note the use of <code>goto</code> that removes us from the caller stack.</p>

      <p>A more complete example can be found here: <a target="_blank" href=
      "http://pastebin.com/Z1QWzcpZ">http://pastebin.com/Z1QWzcpZ</a> It automatically generates
      tag groups from subroutine prefixes.</p>
    </blockquote>

    <p><b>Sérgio</b> , 2013-11-14 21:38:06</p>

    <blockquote>
      <b>case 1</b>

      <p>Library is :</p>
      <pre>
package mycommon;

use strict;
use warnings;

sub onefunctionthatyoumadeonlibary() {
}
1;
</pre>

      <p>you can use it, calling common:: :</p>
      <pre>
#!/usr/bin/perl
use strict;
use warnings;
use mycommon;

common::onefunctionthatyoumadeonlibary()
</pre><b>case 2</b>

      <p>Library is , yousimple export them :</p>
      <pre>
package mycommon;

use strict;
use warnings;

use base 'Exporter';

our @EXPORT = qw(onefunctionthatyoumadeonlibary);
sub onefunctionthatyoumadeonlibary() {
}
1;
</pre>

      <p>use it in same "namespace":</p>
      <pre>
#!/usr/bin/perl
use strict;
use warnings;
use mycommon qw(onefunctionthatyoumadeonlibary);

onefunctionthatyoumadeonlibary()
</pre>

      <p>Also we can do a mix of this two cases , we can export more common functions to use it
      without calling the packages name and other functions that we only call it with package name
      and that ones don't need to be exported.</p>
    </blockquote>

    <p><b>></b> ,</p>

    <blockquote>
      You will have to do some typeglob munging. I describe something similar here:

      <p><a target="_blank" href=
      "https://stackoverflow.com/questions/437785/is-there-a-way-to-use-a-single-file-that-in-turn-uses-multiple-others-in-perl/437835#437835">
      Is there a way to "use" a single file that in turn uses multiple others in Perl?</a></p>

      <p>The import routine there should do exactly what you want -- just don't import any symbols
      into your own namespace.</p>
    </blockquote>

    <p><b>Ville M</b> ,</p>

    <blockquote>
      I would like to expose all subs into my namespace without having to list them one at a time:
      <pre>
@EXPORT = qw( firstsub secondsub third sub etc );
</pre>

      <p>Using fully qualified names would require bunch of change to existing code so I'd rather
      not do that.</p>

      <p>Is there @EXPORT_ALL?</p>

      <p>I think documentation says it's a bad idea, but I'd like to do it anyway, or at least know
      how.</p>

      <p>To answer Jon's why: right now for quick refactoring I want to move of bunch of subs into
      their own package with least hassle and code changes to the existing scripts (where those
      subs are currenty used and often repeated).</p>

      <p>Also, mostly, I was just curious. (since it seemed like that Exporter might as well have
      that as standard feature, but somewhat surprisingly based on answers so far it doesn't)</p>
    </blockquote>

    <p><b>brian d foy</b> , 2009-04-08 23:58:35</p>

    <blockquote>
      Don't do any exporting at all, and don't declare a package name in your library. Just load
      the file with <code>require</code> and everything will be in the current package. Easy peasy.
    </blockquote>

    <p><b>Michael Carman</b> , 2009-04-09 00:15:10</p>

    <blockquote>
      Don't. But if you really want to... write a custom <code>import</code> that walks the symbol
      table and export all the named subroutines.
      <pre>
# Export all subs in package. Not for use in production code!
sub import {
    no strict 'refs';

    my $caller = caller;

    while (my ($name, $symbol) = each %{__PACKAGE__ . '::'}) {
        next if      $name eq 'BEGIN';   # don't export BEGIN blocks
        next if      $name eq 'import';  # don't export this sub
        next unless *{$symbol}{CODE};    # export subs only

        my $imported = $caller . '::' . $name;
        *{ $imported } = \*{ $symbol };
    }
}
</pre>
    </blockquote>

    <p><b>Chas. Owens</b> ,</p>

    <blockquote>
      Warning, the code following is as bad an idea as exporting everything:
      <pre>
package Expo;

use base "Exporter";

seek DATA, 0, 0; #move DATA back to package

#read this file looking for sub names
our @EXPORT = map { /^sub\s+([^({\s]+)/ ? $1 : () } <DATA>;

my $sub = sub {}; #make sure anon funcs aren't grabbed

sub foo($) {
    print shift, "\n";
}

sub bar ($) {
    print shift, "\n";
}

sub baz{
    print shift,"\n";
}

sub quux {
    print shift,"\n";
}

1;

__DATA__
</pre>

      <p>Here is the some code that uses the module:</p>
      <pre>
#!/usr/bin/perl

use strict;
use warnings;

use Expo;

print map { "[$_]\n" } @Expo::EXPORT;

foo("foo");
bar("bar");
baz("baz");
quux("quux");
</pre>

      <p>And here is its output:</p>
      <pre>
[foo]
[bar]
[baz]
[quux]
foo
bar
baz
quux
</pre>
    </blockquote>

    <p><b>Jon Ericson</b> , 2009-04-08 22:33:36</p>

    <blockquote>
      You can always call subroutines in there fully-specified form:
      <pre>
MyModule::firstsub();
</pre>

      <p>For modules I write internally, I find this convention works fairly well. It's a bit more
      typing, but tends to be better documentation.</p>

      <p>Take a look at <code>perldoc perlmod</code> for more information about what you are trying
      to accomplish.</p>

      <p>More generally, you could look at <code>Exporter</code> 's code and see how it uses glob
      aliasing. Or you can examine your module's namespace and export each subroutine. (I don't
      care to search for how to do that at the moment, but Perl makes this fairly easy.) Or you
      could just stick your subroutines in the <code>main</code> package:</p>
      <pre>
 package main;
 sub firstsub() { ... }
</pre>

      <p>(I don't think that's a good idea, but you know better than I do what you are trying to
      accomplish.)</p>

      <p>There's nothing wrong with doing this provided you know what you are doing and aren't just
      trying to avoid thinking about your interface to the outside world.</p>
    </blockquote>

    <p><b>ysth</b> , 2009-04-09 01:29:04</p>

    <blockquote>
      Perhaps you would be interested in one of the Export* modules on CPAN that lets you mark subs
      as exportable simply by adding an attribute to the sub definition? (Don't remember which one
      it was, though.)
    </blockquote>

    <p><b>echo</b> , 2014-10-11 18:23:01</p>

    <blockquote>
      <a target="_blank" href=
      "https://metacpan.org/pod/Exporter::Auto">https://metacpan.org/pod/Exporter::Auto</a>

      <p>Exporter::Auto. this is all you need.</p>
    </blockquote>

    <p><b>Tero Niemi</b> , 2013-04-02 00:32:25</p>

    <blockquote>
      Although it is not usually wise to dump all <code>sub</code> s from module into the caller
      namespace, it is sometimes useful (and more DRY!) to automatically generate
      <code>@EXPORT_OK</code> and <code>%EXPORT_TAGS</code> variables.

      <p>The easiest method is to extend the Exporter. A simple example is something like this:</p>
      <pre>
package Exporter::AutoOkay;
#
#   Automatically add all subroutines from caller package into the
#   @EXPORT_OK array. In the package use like Exporter, f.ex.:
#
#       use parent 'Exporter::AutoOkay';
#
use warnings;
use strict;
no strict 'refs';

require Exporter;

sub import {
    my $package = $_[0].'::';

    # Get the list of exportable items
    my @export_ok = (@{$package.'EXPORT_OK'});

    # Automatically add all subroutines from package into the list
    foreach (keys %{$package}) {
        next unless defined &{$package.$_};
        push @export_ok, $_;
    }

    # Set variable ready for Exporter
    @{$package.'EXPORT_OK'} = @export_ok;

    # Let Exporter do the rest
    goto &Exporter::import;
}

1;
</pre>

      <p>Note the use of <code>goto</code> that removes us from the caller stack.</p>

      <p>A more complete example can be found here: <a target="_blank" href=
      "http://pastebin.com/Z1QWzcpZ">http://pastebin.com/Z1QWzcpZ</a> It automatically generates
      tag groups from subroutine prefixes.</p>
    </blockquote>

    <p><b>Sérgio</b> , 2013-11-14 21:38:06</p>

    <blockquote>
      <b>case 1</b>

      <p>Library is :</p>
      <pre>
package mycommon;

use strict;
use warnings;

sub onefunctionthatyoumadeonlibary() {
}
1;
</pre>

      <p>you can use it, calling common:: :</p>
      <pre>
#!/usr/bin/perl
use strict;
use warnings;
use mycommon;

common::onefunctionthatyoumadeonlibary()
</pre><b>case 2</b>

      <p>Library is , yousimple export them :</p>
      <pre>
package mycommon;

use strict;
use warnings;

use base 'Exporter';

our @EXPORT = qw(onefunctionthatyoumadeonlibary);
sub onefunctionthatyoumadeonlibary() {
}
1;
</pre>

      <p>use it in same "namespace":</p>
      <pre>
#!/usr/bin/perl
use strict;
use warnings;
use mycommon qw(onefunctionthatyoumadeonlibary);

onefunctionthatyoumadeonlibary()
</pre>

      <p>Also we can do a mix of this two cases , we can export more common functions to use it
      without calling the packages name and other functions that we only call it with package name
      and that ones don't need to be exported.</p>
    </blockquote>

    <p><b>></b> ,</p>

    <blockquote>
      You will have to do some typeglob munging. I describe something similar here:

      <p><a target="_blank" href=
      "https://stackoverflow.com/questions/437785/is-there-a-way-to-use-a-single-file-that-in-turn-uses-multiple-others-in-perl/437835#437835">
      Is there a way to "use" a single file that in turn uses multiple others in Perl?</a></p>

      <p>The import routine there should do exactly what you want -- just don't import any symbols
      into your own namespace.</p>
    </blockquote>

    <p><b>Ville M</b> ,</p>

    <blockquote>
      I would like to expose all subs into my namespace without having to list them one at a time:
      <pre>
@EXPORT = qw( firstsub secondsub third sub etc );
</pre>

      <p>Using fully qualified names would require bunch of change to existing code so I'd rather
      not do that.</p>

      <p>Is there @EXPORT_ALL?</p>

      <p>I think documentation says it's a bad idea, but I'd like to do it anyway, or at least know
      how.</p>

      <p>To answer Jon's why: right now for quick refactoring I want to move of bunch of subs into
      their own package with least hassle and code changes to the existing scripts (where those
      subs are currenty used and often repeated).</p>

      <p>Also, mostly, I was just curious. (since it seemed like that Exporter might as well have
      that as standard feature, but somewhat surprisingly based on answers so far it doesn't)</p>
    </blockquote>

    <p><b>brian d foy</b> , 2009-04-08 23:58:35</p>

    <blockquote>
      Don't do any exporting at all, and don't declare a package name in your library. Just load
      the file with <code>require</code> and everything will be in the current package. Easy peasy.
    </blockquote>

    <p><b>Michael Carman</b> , 2009-04-09 00:15:10</p>

    <blockquote>
      Don't. But if you really want to... write a custom <code>import</code> that walks the symbol
      table and export all the named subroutines.
      <pre>
# Export all subs in package. Not for use in production code!
sub import {
    no strict 'refs';

    my $caller = caller;

    while (my ($name, $symbol) = each %{__PACKAGE__ . '::'}) {
        next if      $name eq 'BEGIN';   # don't export BEGIN blocks
        next if      $name eq 'import';  # don't export this sub
        next unless *{$symbol}{CODE};    # export subs only

        my $imported = $caller . '::' . $name;
        *{ $imported } = \*{ $symbol };
    }
}
</pre>
    </blockquote>

    <p><b>Chas. Owens</b> ,</p>

    <blockquote>
      Warning, the code following is as bad an idea as exporting everything:
      <pre>
package Expo;

use base "Exporter";

seek DATA, 0, 0; #move DATA back to package

#read this file looking for sub names
our @EXPORT = map { /^sub\s+([^({\s]+)/ ? $1 : () } <DATA>;

my $sub = sub {}; #make sure anon funcs aren't grabbed

sub foo($) {
    print shift, "\n";
}

sub bar ($) {
    print shift, "\n";
}

sub baz{
    print shift,"\n";
}

sub quux {
    print shift,"\n";
}

1;

__DATA__
</pre>

      <p>Here is the some code that uses the module:</p>
      <pre>
#!/usr/bin/perl

use strict;
use warnings;

use Expo;

print map { "[$_]\n" } @Expo::EXPORT;

foo("foo");
bar("bar");
baz("baz");
quux("quux");
</pre>

      <p>And here is its output:</p>
      <pre>
[foo]
[bar]
[baz]
[quux]
foo
bar
baz
quux
</pre>
    </blockquote>

    <p><b>Jon Ericson</b> , 2009-04-08 22:33:36</p>

    <blockquote>
      You can always call subroutines in there fully-specified form:
      <pre>
MyModule::firstsub();
</pre>

      <p>For modules I write internally, I find this convention works fairly well. It's a bit more
      typing, but tends to be better documentation.</p>

      <p>Take a look at <code>perldoc perlmod</code> for more information about what you are trying
      to accomplish.</p>

      <p>More generally, you could look at <code>Exporter</code> 's code and see how it uses glob
      aliasing. Or you can examine your module's namespace and export each subroutine. (I don't
      care to search for how to do that at the moment, but Perl makes this fairly easy.) Or you
      could just stick your subroutines in the <code>main</code> package:</p>
      <pre>
 package main;
 sub firstsub() { ... }
</pre>

      <p>(I don't think that's a good idea, but you know better than I do what you are trying to
      accomplish.)</p>

      <p>There's nothing wrong with doing this provided you know what you are doing and aren't just
      trying to avoid thinking about your interface to the outside world.</p>
    </blockquote>

    <p><b>ysth</b> , 2009-04-09 01:29:04</p>

    <blockquote>
      Perhaps you would be interested in one of the Export* modules on CPAN that lets you mark subs
      as exportable simply by adding an attribute to the sub definition? (Don't remember which one
      it was, though.)
    </blockquote>

    <p><b>echo</b> , 2014-10-11 18:23:01</p>

    <blockquote>
      <a target="_blank" href=
      "https://metacpan.org/pod/Exporter::Auto">https://metacpan.org/pod/Exporter::Auto</a>

      <p>Exporter::Auto. this is all you need.</p>
    </blockquote>

    <p><b>Tero Niemi</b> , 2013-04-02 00:32:25</p>

    <blockquote>
      Although it is not usually wise to dump all <code>sub</code> s from module into the caller
      namespace, it is sometimes useful (and more DRY!) to automatically generate
      <code>@EXPORT_OK</code> and <code>%EXPORT_TAGS</code> variables.

      <p>The easiest method is to extend the Exporter. A simple example is something like this:</p>
      <pre>
package Exporter::AutoOkay;
#
#   Automatically add all subroutines from caller package into the
#   @EXPORT_OK array. In the package use like Exporter, f.ex.:
#
#       use parent 'Exporter::AutoOkay';
#
use warnings;
use strict;
no strict 'refs';

require Exporter;

sub import {
    my $package = $_[0].'::';

    # Get the list of exportable items
    my @export_ok = (@{$package.'EXPORT_OK'});

    # Automatically add all subroutines from package into the list
    foreach (keys %{$package}) {
        next unless defined &{$package.$_};
        push @export_ok, $_;
    }

    # Set variable ready for Exporter
    @{$package.'EXPORT_OK'} = @export_ok;

    # Let Exporter do the rest
    goto &Exporter::import;
}

1;
</pre>

      <p>Note the use of <code>goto</code> that removes us from the caller stack.</p>

      <p>A more complete example can be found here: <a target="_blank" href=
      "http://pastebin.com/Z1QWzcpZ">http://pastebin.com/Z1QWzcpZ</a> It automatically generates
      tag groups from subroutine prefixes.</p>
    </blockquote>

    <p><b>Sérgio</b> , 2013-11-14 21:38:06</p>

    <blockquote>
      <b>case 1</b>

      <p>Library is :</p>
      <pre>
package mycommon;

use strict;
use warnings;

sub onefunctionthatyoumadeonlibary() {
}
1;
</pre>

      <p>you can use it, calling common:: :</p>
      <pre>
#!/usr/bin/perl
use strict;
use warnings;
use mycommon;

common::onefunctionthatyoumadeonlibary()
</pre><b>case 2</b>

      <p>Library is , yousimple export them :</p>
      <pre>
package mycommon;

use strict;
use warnings;

use base 'Exporter';

our @EXPORT = qw(onefunctionthatyoumadeonlibary);
sub onefunctionthatyoumadeonlibary() {
}
1;
</pre>

      <p>use it in same "namespace":</p>
      <pre>
#!/usr/bin/perl
use strict;
use warnings;
use mycommon qw(onefunctionthatyoumadeonlibary);

onefunctionthatyoumadeonlibary()
</pre>

      <p>Also we can do a mix of this two cases , we can export more common functions to use it
      without calling the packages name and other functions that we only call it with package name
      and that ones don't need to be exported.</p>
    </blockquote>

    <p><b>></b> ,</p>

    <blockquote>
      You will have to do some typeglob munging. I describe something similar here:

      <p><a target="_blank" href=
      "https://stackoverflow.com/questions/437785/is-there-a-way-to-use-a-single-file-that-in-turn-uses-multiple-others-in-perl/437835#437835">
      Is there a way to "use" a single file that in turn uses multiple others in Perl?</a></p>

      <p>The import routine there should do exactly what you want -- just don't import any symbols
      into your own namespace.</p>
    </blockquote>

    <p><b>Ville M</b> ,</p>

    <blockquote>
      I would like to expose all subs into my namespace without having to list them one at a time:
      <pre>
@EXPORT = qw( firstsub secondsub third sub etc );
</pre>

      <p>Using fully qualified names would require bunch of change to existing code so I'd rather
      not do that.</p>

      <p>Is there @EXPORT_ALL?</p>

      <p>I think documentation says it's a bad idea, but I'd like to do it anyway, or at least know
      how.</p>

      <p>To answer Jon's why: right now for quick refactoring I want to move of bunch of subs into
      their own package with least hassle and code changes to the existing scripts (where those
      subs are currenty used and often repeated).</p>

      <p>Also, mostly, I was just curious. (since it seemed like that Exporter might as well have
      that as standard feature, but somewhat surprisingly based on answers so far it doesn't)</p>
    </blockquote>

    <p><b>brian d foy</b> , 2009-04-08 23:58:35</p>

    <blockquote>
      Don't do any exporting at all, and don't declare a package name in your library. Just load
      the file with <code>require</code> and everything will be in the current package. Easy peasy.
    </blockquote>

    <p><b>Michael Carman</b> , 2009-04-09 00:15:10</p>

    <blockquote>
      Don't. But if you really want to... write a custom <code>import</code> that walks the symbol
      table and export all the named subroutines.
      <pre>
# Export all subs in package. Not for use in production code!
sub import {
    no strict 'refs';

    my $caller = caller;

    while (my ($name, $symbol) = each %{__PACKAGE__ . '::'}) {
        next if      $name eq 'BEGIN';   # don't export BEGIN blocks
        next if      $name eq 'import';  # don't export this sub
        next unless *{$symbol}{CODE};    # export subs only

        my $imported = $caller . '::' . $name;
        *{ $imported } = \*{ $symbol };
    }
}
</pre>
    </blockquote>

    <p><b>Chas. Owens</b> ,</p>

    <blockquote>
      Warning, the code following is as bad an idea as exporting everything:
      <pre>
package Expo;

use base "Exporter";

seek DATA, 0, 0; #move DATA back to package

#read this file looking for sub names
our @EXPORT = map { /^sub\s+([^({\s]+)/ ? $1 : () } <DATA>;

my $sub = sub {}; #make sure anon funcs aren't grabbed

sub foo($) {
    print shift, "\n";
}

sub bar ($) {
    print shift, "\n";
}

sub baz{
    print shift,"\n";
}

sub quux {
    print shift,"\n";
}

1;

__DATA__
</pre>

      <p>Here is the some code that uses the module:</p>
      <pre>
#!/usr/bin/perl

use strict;
use warnings;

use Expo;

print map { "[$_]\n" } @Expo::EXPORT;

foo("foo");
bar("bar");
baz("baz");
quux("quux");
</pre>

      <p>And here is its output:</p>
      <pre>
[foo]
[bar]
[baz]
[quux]
foo
bar
baz
quux
</pre>
    </blockquote>

    <p><b>Jon Ericson</b> , 2009-04-08 22:33:36</p>

    <blockquote>
      You can always call subroutines in there fully-specified form:
      <pre>
MyModule::firstsub();
</pre>

      <p>For modules I write internally, I find this convention works fairly well. It's a bit more
      typing, but tends to be better documentation.</p>

      <p>Take a look at <code>perldoc perlmod</code> for more information about what you are trying
      to accomplish.</p>

      <p>More generally, you could look at <code>Exporter</code> 's code and see how it uses glob
      aliasing. Or you can examine your module's namespace and export each subroutine. (I don't
      care to search for how to do that at the moment, but Perl makes this fairly easy.) Or you
      could just stick your subroutines in the <code>main</code> package:</p>
      <pre>
 package main;
 sub firstsub() { ... }
</pre>

      <p>(I don't think that's a good idea, but you know better than I do what you are trying to
      accomplish.)</p>

      <p>There's nothing wrong with doing this provided you know what you are doing and aren't just
      trying to avoid thinking about your interface to the outside world.</p>
    </blockquote>

    <p><b>ysth</b> , 2009-04-09 01:29:04</p>

    <blockquote>
      Perhaps you would be interested in one of the Export* modules on CPAN that lets you mark subs
      as exportable simply by adding an attribute to the sub definition? (Don't remember which one
      it was, though.)
    </blockquote>

    <p><b>echo</b> , 2014-10-11 18:23:01</p>

    <blockquote>
      <a target="_blank" href=
      "https://metacpan.org/pod/Exporter::Auto">https://metacpan.org/pod/Exporter::Auto</a>

      <p>Exporter::Auto. this is all you need.</p>
    </blockquote>

    <p><b>Tero Niemi</b> , 2013-04-02 00:32:25</p>

    <blockquote>
      Although it is not usually wise to dump all <code>sub</code> s from module into the caller
      namespace, it is sometimes useful (and more DRY!) to automatically generate
      <code>@EXPORT_OK</code> and <code>%EXPORT_TAGS</code> variables.

      <p>The easiest method is to extend the Exporter. A simple example is something like this:</p>
      <pre>
package Exporter::AutoOkay;
#
#   Automatically add all subroutines from caller package into the
#   @EXPORT_OK array. In the package use like Exporter, f.ex.:
#
#       use parent 'Exporter::AutoOkay';
#
use warnings;
use strict;
no strict 'refs';

require Exporter;

sub import {
    my $package = $_[0].'::';

    # Get the list of exportable items
    my @export_ok = (@{$package.'EXPORT_OK'});

    # Automatically add all subroutines from package into the list
    foreach (keys %{$package}) {
        next unless defined &{$package.$_};
        push @export_ok, $_;
    }

    # Set variable ready for Exporter
    @{$package.'EXPORT_OK'} = @export_ok;

    # Let Exporter do the rest
    goto &Exporter::import;
}

1;
</pre>

      <p>Note the use of <code>goto</code> that removes us from the caller stack.</p>

      <p>A more complete example can be found here: <a target="_blank" href=
      "http://pastebin.com/Z1QWzcpZ">http://pastebin.com/Z1QWzcpZ</a> It automatically generates
      tag groups from subroutine prefixes.</p>
    </blockquote>

    <p><b>Sérgio</b> , 2013-11-14 21:38:06</p>

    <blockquote>
      <b>case 1</b>

      <p>Library is :</p>
      <pre>
package mycommon;

use strict;
use warnings;

sub onefunctionthatyoumadeonlibary() {
}
1;
</pre>

      <p>you can use it, calling common:: :</p>
      <pre>
#!/usr/bin/perl
use strict;
use warnings;
use mycommon;

common::onefunctionthatyoumadeonlibary()
</pre><b>case 2</b>

      <p>Library is , yousimple export them :</p>
      <pre>
package mycommon;

use strict;
use warnings;

use base 'Exporter';

our @EXPORT = qw(onefunctionthatyoumadeonlibary);
sub onefunctionthatyoumadeonlibary() {
}
1;
</pre>

      <p>use it in same "namespace":</p>
      <pre>
#!/usr/bin/perl
use strict;
use warnings;
use mycommon qw(onefunctionthatyoumadeonlibary);

onefunctionthatyoumadeonlibary()
</pre>

      <p>Also we can do a mix of this two cases , we can export more common functions to use it
      without calling the packages name and other functions that we only call it with package name
      and that ones don't need to be exported.</p>
    </blockquote>

    <p><b>></b> ,</p>

    <blockquote>
      You will have to do some typeglob munging. I describe something similar here:

      <p><a target="_blank" href=
      "https://stackoverflow.com/questions/437785/is-there-a-way-to-use-a-single-file-that-in-turn-uses-multiple-others-in-perl/437835#437835">
      Is there a way to "use" a single file that in turn uses multiple others in Perl?</a></p>

      <p>The import routine there should do exactly what you want -- just don't import any symbols
      into your own namespace.</p>
    </blockquote>
 <!--TAGS: . ~/Scripting -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_modules.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191201X_how_can_i_export_all_subs_in_a_perl_package"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191201X_function_how_can_i_export_all_subs_in_a_perl_package_stack_overflow" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191129X_was_mikhail_gorbachev_an_incompetent_leader_or_a_stooge_of_the_west_quora"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Dec 01, 2019] <a target="_blank" href="https://stackoverflow.com/questions/732133/how-can-i-export-all-subs-in-a-perl-package">function   - How can I export all subs in a Perl package - Stack Overflow</a></h4>

<blockquote>
<h6>Jan 01, 2009 |  <a target="_blank" href= "https://stackoverflow.com/questions/732133/how-can-i-export-all-subs-in-a-perl-package">stackoverflow.com</a></h6>
 

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/questions/732133/how-can-i-export-all-subs-in-a-perl-package">How
    can I export all subs in a Perl package?</a></b> <a target="_blank" href=
    "https://stackoverflow.com/questions/ask">Ask Question</a> Asked 10 years, 7 months ago Active
    <a target="_blank" href=
    "https://stackoverflow.com/questions/732133/how-can-i-export-all-subs-in-a-perl-package?lastactivity">
    3 years, 5 months ago</a> Viewed 18k times</p>
    <hr noshade align="left" width="10" size="10">

    <p><b>Ville M</b> ,</p>

    <blockquote>
      I would like to expose all subs into my namespace without having to list them one at a time:
      <pre>
@EXPORT = qw( firstsub secondsub third sub etc );
</pre>

      <p>Using fully qualified names would require bunch of change to existing code so I'd rather
      not do that.</p>

      <p>Is there @EXPORT_ALL?</p>

      <p>I think documentation says it's a bad idea, but I'd like to do it anyway, or at least know
      how.</p>

      <p>To answer Jon's why: right now for quick refactoring I want to move of bunch of subs into
      their own package with least hassle and code changes to the existing scripts (where those
      subs are currenty used and often repeated).</p>

      <p>Also, mostly, I was just curious. (since it seemed like that Exporter might as well have
      that as standard feature, but somewhat surprisingly based on answers so far it doesn't)</p>
    </blockquote>

    <p><b>brian d foy</b> , 2009-04-08 23:58:35</p>

    <blockquote>
      Don't do any exporting at all, and don't declare a package name in your library. Just load
      the file with <code>require</code> and everything will be in the current package. Easy peasy.
    </blockquote>

    <p><b>Michael Carman</b> , 2009-04-09 00:15:10</p>

    <blockquote>
      Don't. But if you really want to... write a custom <code>import</code> that walks the symbol
      table and export all the named subroutines.
      <pre>
# Export all subs in package. Not for use in production code!
sub import {
    no strict 'refs';

    my $caller = caller;

    while (my ($name, $symbol) = each %{__PACKAGE__ . '::'}) {
        next if      $name eq 'BEGIN';   # don't export BEGIN blocks
        next if      $name eq 'import';  # don't export this sub
        next unless *{$symbol}{CODE};    # export subs only

        my $imported = $caller . '::' . $name;
        *{ $imported } = \*{ $symbol };
    }
}
</pre>
    </blockquote>

    <p><b>Chas. Owens</b> ,</p>

    <blockquote>
      Warning, the code following is as bad an idea as exporting everything:
      <pre>
package Expo;

use base "Exporter";

seek DATA, 0, 0; #move DATA back to package

#read this file looking for sub names
our @EXPORT = map { /^sub\s+([^({\s]+)/ ? $1 : () } <DATA>;

my $sub = sub {}; #make sure anon funcs aren't grabbed

sub foo($) {
    print shift, "\n";
}

sub bar ($) {
    print shift, "\n";
}

sub baz{
    print shift,"\n";
}

sub quux {
    print shift,"\n";
}

1;

__DATA__
</pre>

      <p>Here is the some code that uses the module:</p>
      <pre>
#!/usr/bin/perl

use strict;
use warnings;

use Expo;

print map { "[$_]\n" } @Expo::EXPORT;

foo("foo");
bar("bar");
baz("baz");
quux("quux");
</pre>

      <p>And here is its output:</p>
      <pre>
[foo]
[bar]
[baz]
[quux]
foo
bar
baz
quux
</pre>
    </blockquote>

    <p><b>Jon Ericson</b> , 2009-04-08 22:33:36</p>

    <blockquote>
      You can always call subroutines in there fully-specified form:
      <pre>
MyModule::firstsub();
</pre>

      <p>For modules I write internally, I find this convention works fairly well. It's a bit more
      typing, but tends to be better documentation.</p>

      <p>Take a look at <code>perldoc perlmod</code> for more information about what you are trying
      to accomplish.</p>

      <p>More generally, you could look at <code>Exporter</code> 's code and see how it uses glob
      aliasing. Or you can examine your module's namespace and export each subroutine. (I don't
      care to search for how to do that at the moment, but Perl makes this fairly easy.) Or you
      could just stick your subroutines in the <code>main</code> package:</p>
      <pre>
 package main;
 sub firstsub() { ... }
</pre>

      <p>(I don't think that's a good idea, but you know better than I do what you are trying to
      accomplish.)</p>

      <p>There's nothing wrong with doing this provided you know what you are doing and aren't just
      trying to avoid thinking about your interface to the outside world.</p>
    </blockquote>

    <p><b>ysth</b> , 2009-04-09 01:29:04</p>

    <blockquote>
      Perhaps you would be interested in one of the Export* modules on CPAN that lets you mark subs
      as exportable simply by adding an attribute to the sub definition? (Don't remember which one
      it was, though.)
    </blockquote>

    <p><b>echo</b> , 2014-10-11 18:23:01</p>

    <blockquote>
      <a target="_blank" href=
      "https://metacpan.org/pod/Exporter::Auto">https://metacpan.org/pod/Exporter::Auto</a>

      <p>Exporter::Auto. this is all you need.</p>
    </blockquote>

    <p><b>Tero Niemi</b> , 2013-04-02 00:32:25</p>

    <blockquote>
      Although it is not usually wise to dump all <code>sub</code> s from module into the caller
      namespace, it is sometimes useful (and more DRY!) to automatically generate
      <code>@EXPORT_OK</code> and <code>%EXPORT_TAGS</code> variables.

      <p>The easiest method is to extend the Exporter. A simple example is something like this:</p>
      <pre>
package Exporter::AutoOkay;
#
#   Automatically add all subroutines from caller package into the
#   @EXPORT_OK array. In the package use like Exporter, f.ex.:
#
#       use parent 'Exporter::AutoOkay';
#
use warnings;
use strict;
no strict 'refs';

require Exporter;

sub import {
    my $package = $_[0].'::';

    # Get the list of exportable items
    my @export_ok = (@{$package.'EXPORT_OK'});

    # Automatically add all subroutines from package into the list
    foreach (keys %{$package}) {
        next unless defined &{$package.$_};
        push @export_ok, $_;
    }

    # Set variable ready for Exporter
    @{$package.'EXPORT_OK'} = @export_ok;

    # Let Exporter do the rest
    goto &Exporter::import;
}

1;
</pre>

      <p>Note the use of <code>goto</code> that removes us from the caller stack.</p>

      <p>A more complete example can be found here: <a target="_blank" href=
      "http://pastebin.com/Z1QWzcpZ">http://pastebin.com/Z1QWzcpZ</a> It automatically generates
      tag groups from subroutine prefixes.</p>
    </blockquote>

    <p><b>Sérgio</b> , 2013-11-14 21:38:06</p>

    <blockquote>
      <b>case 1</b>

      <p>Library is :</p>
      <pre>
package mycommon;

use strict;
use warnings;

sub onefunctionthatyoumadeonlibary() {
}
1;
</pre>

      <p>you can use it, calling common:: :</p>
      <pre>
#!/usr/bin/perl
use strict;
use warnings;
use mycommon;

common::onefunctionthatyoumadeonlibary()
</pre><b>case 2</b>

      <p>Library is , yousimple export them :</p>
      <pre>
package mycommon;

use strict;
use warnings;

use base 'Exporter';

our @EXPORT = qw(onefunctionthatyoumadeonlibary);
sub onefunctionthatyoumadeonlibary() {
}
1;
</pre>

      <p>use it in same "namespace":</p>
      <pre>
#!/usr/bin/perl
use strict;
use warnings;
use mycommon qw(onefunctionthatyoumadeonlibary);

onefunctionthatyoumadeonlibary()
</pre>

      <p>Also we can do a mix of this two cases , we can export more common functions to use it
      without calling the packages name and other functions that we only call it with package name
      and that ones don't need to be exported.</p>
    </blockquote>

    <p><b>></b> ,</p>

    <blockquote>
      You will have to do some typeglob munging. I describe something similar here:

      <p><a target="_blank" href=
      "https://stackoverflow.com/questions/437785/is-there-a-way-to-use-a-single-file-that-in-turn-uses-multiple-others-in-perl/437835#437835">
      Is there a way to "use" a single file that in turn uses multiple others in Perl?</a></p>

      <p>The import routine there should do exactly what you want -- just don't import any symbols
      into your own namespace.</p>
    </blockquote>
 <!--TAGS: . ~/Scripting -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_modules.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191201X_function_how_can_i_export_all_subs_in_a_perl_package_stack_overflow"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191129X_was_mikhail_gorbachev_an_incompetent_leader_or_a_stooge_of_the_west_quora" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191123X_static_local_variables_in_perl"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 29, 2019] <a target="_blank" href="https://www.quora.com/Was-Mikhail-Gorbachev-an-incompetent-leader-or-a-stooge-of-the-West">Was   Mikhail Gorbachev an incompetent leader or a stooge of the West - Quora</a></h4>

<blockquote>
<h6>Nov 29, 2019 |  <a target="_blank" href= "https://www.quora.com/Was-Mikhail-Gorbachev-an-incompetent-leader-or-a-stooge-of-the-West">www.quora.com</a></h6>
 

    <p><a target="_blank" href="https://www.quora.com/profile/Joe-Venetos">Joe Venetos</a> ,
    history, European Union and politics, int'l relations <a target="_blank" href=
    "https://www.quora.com/Was-Mikhail-Gorbachev-an-incompetent-leader-or-a-stooge-of-the-West/answer/Joe-Venetos">
    Answered Aug 22 2017</a> · Author has 485 answers and 325k answer views</p>

    <p>Neither.</p>

    <p>The USSR as it was was not sustainable, and the writing was all over the wall.</p>

    <p>The <i>reason</i> it wasn't sustainable, however, is widely misunderstood.</p>

    <p>The Soviet Union could have switched to a market or hybrid economy and still remained a
    unified state. However, it was made up of 15 very different essentially nation-states from
    Estonia to Uzbekistan, and separatist movements were tearing the Union apart.</p>

    <p>Unlike other multi-national European empires that met their day earlier in the 20th century,
    such as the British, French, Portuguese, Austro-Hungarian, or Ottoman Empires, the Russian
    Empi...</p><a target="_blank" href=
    "https://www.quora.com/Was-Mikhail-Gorbachev-an-incompetent-leader-or-a-stooge-of-the-West#">(more)</a>
    Loading

    <p>Neither.</p>

    <p>The USSR as it was was not sustainable, and the writing was all over the wall.</p>

    <p>The <i>reason</i> it wasn't sustainable, however, is widely misunderstood.</p>

    <p>The Soviet Union could have switched to a market or hybrid economy and still remained a
    unified state. However, it was made up of 15 very different essentially nation-states from
    Estonia to Uzbekistan, and separatist movements were tearing the Union apart.</p>

    <p>Unlike other multi-national European empires that met their day earlier in the 20th century,
    such as the British, French, Portuguese, Austro-Hungarian, or Ottoman Empires, the Russian
    Empire never had the chance to disband; the can was simply kicked down the road by the
    Bolshevik revolution and the Soviet era. Restrictions on free speech and press, followed by a
    gradual economic downturn that began in the 1970s, brewed anti-Union and separatist sentiments
    among sizeable sections of society. It's important to note, however, that not everyone wanted
    the disband the USSR, and not everyone in the Russian republic wanted to keep it together (the
    Central Asian states were the most reluctant to secede). There was, actually, a referendum on
    whether or not to keep the Union together, and a slight majority voted in favor (something
    Gorbachev points out to this day), but the vote was also boycotted by quite a few people,
    especially in the Baltic republics. So, we know that the citizens had mixed feelings and the
    reasons for the USSR's end were far more complex than just "communism failed".</p>

    <p>By the summer of 1991, there was nothing Gorbachev could do. The hardliners saw him as
    incompetent to save the Union, but too many citizens and military personnel had defected to the
    politicians of the constituent republics (rather than the Union's leadership), including Russia
    itself, that were increasingly pursuing their independence since the first multiparty elections
    across the Union in 1989. By <i>December</i> 1991, Union-level political bodies agreed to
    disband. So, Gorbachev had no choice but to admit that the USSR no longer existed.</p>

    <p>Gorbachev <i>could</i> have ruled with an iron fist, and he could have done so from the 1985
    without ever implementing glasnost and perestroika, but that <i>could</i> have been a disaster.
    We don't really know, actually, but in my opinion, an <i>oligarchy</i> -which is what the USSR
    was in its <i>later</i> years, not an authoritarian state like it was under Stalin- still needs
    some level of public consent to continue governing, like China (which is also a diverse
    society, but far more homogenous than the USSR was). If you have all this economic and
    separatist malaise brewing, it's not going to work out.</p>

    <p>In the long run, Russia is <i>much</i> better off. They now have a state where ethnic
    Russians make up 80% of the population (a good balance), from what was, I think 50% in the
    USSR.</p>

    <p>While some Russians regret that the USSR ended, others don't care or were ready to call
    themselves "Russian" rather than "Soviet". It's no different to French public opinion turning
    against the Algerian war in the 1960s and supporting Algerian independence, or British public
    opinion starting to support the independence of India yet some people from those countries, may
    look back fondly. Also, Russia went through a tough economic period in the 1990s, which
    strengthened Soviet nostalgia, understandably, thinking back to a time when the state
    guaranteed everyone with housing and a job. While <i>some</i> sentiments still exist today in
    the Russian Federation that may appear pro-Soviet, it's important to point out that that
    doesn't <i>necessarily</i> mean these folks would like to recreate the Soviet Union <i>as it
    was</i> . Many just simply miss the heaftier influence the USSR had, versus what they perceive
    to be weakness or disrespect for Russia today. The communist party today gets few votes in
    Russian elections; and many Russians now were not adults prior to 1991, and thus don't quite
    remember the era too well; many others may be old enough to remember the economic downturn of
    the 80s, and not the economic good times of the 60s.</p>

    <p>One final point, regarding Gorbachev being a "stooge of the West": that gives <i>far</i> too
    much credit to America under Reagan for taking down the USSR. The "West" had nothing to do with
    it. In the longer run, as we may be seeing slowly unravel since the Bush Jr administration,
    America pretty much screwed itself with the massive military spending that started in the 80s
    and continues upward, with supporting the mujahedeen to lure the USSR into Afghanistan in 1979
    (a war that lasted until 1989), with opposing <i>any</i> secular regime in the Middle East
    friendly to Moscow in the 70s and 80s, and so on we all know how these events started playing
    out for the US much later, from 9/11 to the current Trump mess.</p>
 <!--TAGS: . ~/Perl -->
 <!--file:///f:/Public_html/Skeptics/Political_skeptic/Fighting_russophobia/Collapse_of_the_ussr/great_plunder.shtml-->
<!--file:///f:/Public_html/Skeptics/Pseudoscience/harvard_mafia.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Fighting_russophobia/collapse_of_the_ussr.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Fighting_russophobia/cold_war2.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Fighting_russophobia/index.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/index.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/neocons.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Neocons/neocon_foreign_policy.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/media_military_industrial_complex.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Neocons/Bulletin/neoconservatism_bulletin2019.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Neocons/Foreign_policy/neocon_foreign_policy.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191129X_was_mikhail_gorbachev_an_incompetent_leader_or_a_stooge_of_the_west_quora"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191123X_static_local_variables_in_perl" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191123X_introduction_to_perl_modules"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 23, 2019] <a target="_blank" href="https://stackoverflow.com/questions/10841076/static-local-variables-in-perl">Static local   variables in Perl</a></h4>

<blockquote>
<h6>Jan 01, 2012 |  <a target="_blank" href= "https://stackoverflow.com/questions/10841076/static-local-variables-in-perl">stackoverflow.com</a></h6>
 
 

    <p><a target="_blank" href="https://stackoverflow.com/questions/ask">Ask Question</a> Asked 7
    years, 5 months ago Active <a target="_blank" href=
    "https://stackoverflow.com/questions/10841076/static-local-variables-in-perl?lastactivity">2
    years, 8 months ago</a> Viewed 12k times</p>
    <hr noshade align="left" width="10" size="10">

    <p><b>Charles</b> , 2012-05-31 20:50:19</p>

    <blockquote>
      I'm looking for advice on Perl best practices. I wrote a script which had a complicated
      regular expression:
      <pre>
my $regex = qr/complicated/;

# ...

sub foo {
  # ...

  if (/$regex/)
  # ...
}
</pre>

      <p>where <code>foo</code> is a function which is called often, and <code>$regex</code> is not
      used outside that function. What is the best way to handle situations like this? I only want
      it to be interpreted once, since it's long and complicated. But it seems a bit questionable
      to have it in global scope since it's only used in that sub. Is there a reasonable way to
      declare it static?</p>

      <p>A similar issue arises with another possibly-unjustified global. It reads in the current
      date and time and formats it appropriately. This is also used many times, and again only in
      one function. But in this case it's even more important that it not be re-initialized, since
      I want all instances of the date-time to be the same from a given invocation of the script,
      even if the minutes roll over during execution.</p>

      <p>At the moment I have something like</p>
      <pre>
my ($regex, $DT);

sub driver {
  $regex = qr/complicated/;
  $DT = dateTime();
  # ...
}

# ...

driver();
</pre>

      <p>which at least slightly segregates it. But perhaps there are better ways.</p>

      <p>Again: I'm looking for the right way to do this, in terms of following best practices and
      Perl idioms. Performance is nice but readability and other needs take priority if I can't
      have everything.</p>
    </blockquote>

    <p><b>hobbs</b> ,</p>

    <blockquote>
      If you're using perl 5.10+, use a <code>state</code> variable.
      <pre>
use feature 'state';
# use 5.010; also works

sub womble {
    state $foo = something_expensive();
    return $foo ** 2;
}
</pre>

      <p>will only call <code>something_expensive</code> once.</p>

      <p>If you need to work with older perls, then use a lexical variable in an outer scope with
      an extra pair of braces:</p>
      <pre>
{
    my $foo = something_expensive();
    sub womble {
        return $foo ** 2;
    }
}
</pre>

      <p>this keeps <code>$foo</code> from leaking to anyone except for <code>womble</code> .</p>
    </blockquote>

    <p><b>ikegami</b> , 2012-05-31 21:14:04</p>

    <blockquote>
      Is there any interpolation in the pattern? If not, the pattern will only be compiled once no
      matter how many times the qr// is executed.
      <pre>
$ perl -Mre=debug -e'qr/foo/ for 1..10' 2>&1 | grep Compiling | wc -l
1

$ perl -Mre=debug -e'qr/foo$_/ for 1..10' 2>&1 | grep Compiling | wc -l
10
</pre>

      <p>Even if there is interpolation, the pattern will only be compiled if the interpolated
      variables have changed.</p>
      <pre>
$ perl -Mre=debug -e'$x=123; qr/foo$x/ for 1..10;' 2>&1 | grep Compiling | wc -l
1

$ perl -Mre=debug -e'qr/foo$_/ for 1..10' 2>&1 | grep Compiling | wc -l
10
</pre>

      <p>Otherwise, you can use</p>
      <pre>
{
   my $re = qr/.../;
   sub foo {
      ...
      /$re/
      ...
   }
}
</pre>

      <p>or</p>
      <pre>
use feature qw( state );
sub foo {
   state $re = qr/.../;
   ...
   /$re/
   ...
}
</pre>
    </blockquote>

    <p><b>Alan Rocker</b> , 2014-07-02 16:25:27</p>

    <blockquote>
      Regexes can be specified with the "o" modifier, which says "compile pattern once only" - in
      the 3rd. edition of the Camel, see p. 147
    </blockquote>

    <p><b>zoul</b> ,</p>

    <blockquote>
      There's a <a target="_blank" href="http://perldoc.perl.org/functions/state.html">state</a>
      keyword that might be a good fit for this situation:
      <pre>
sub foo {
    state $regex = /.../;
    ...
}
</pre>
    </blockquote>

    <p><b>TrueY</b> , 2015-01-23 10:14:12</p>

    <blockquote>
      I would like to complete <code>ikegami</code> 's great answer. Some more words I would like
      to waste on the definition of local variables in pre 5.10 <a target="_blank" href=
      "https://stackoverflow.com/questions/tagged/perl">perl</a> .

      <p>Let's see a simple example code:</p>
      <pre>
#!/bin/env perl 

use strict;
use warnings;

{ # local 
my $local = "After Crying";
sub show { print $local,"\n"; }
} # local

sub show2;

show;
show2;

exit;

{ # local 
my $local = "Solaris";
sub show2 { print $local,"\n"; }
} # local
</pre>

      <p>The user would expect that both <code>sub</code> will print the local variable, but this
      is not true!</p>

      <p>Output:</p>
      <pre>
After Crying
Use of uninitialized value $local in print at ./x.pl line 20.
</pre>

      <p>The reason is that <code>show2</code> is parsed, but the initialization of the local
      variable is not executed! (Of course if <code>exit</code> is removed and a <code>show2</code>
      is added at the end, <code>Solaris</code> will be printed in the thirds line)</p>

      <p>This can be fixed easily:</p>
      <pre>
{ # local 
my $local;
BEGIN { $local = "Solaris"; }
sub show2 { print $local,"\n"; }
} # local
</pre>

      <p>And now the output what was expected:</p>
      <pre>
After Crying
Solaris
</pre>

      <p>But <code>state</code> in 5.10+ is a better choice...</p>

      <p>I hope this helps!</p>
    </blockquote>
 
<!--TAGS: . ~/Scripting -->
 <!--file:///f:/Public_html/Scripting/Perlorama/Variables/state_variables.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/Variables/our_variables.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/Variables/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>


</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191123X_static_local_variables_in_perl"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191123X_introduction_to_perl_modules" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191123X_min_max_sum_in_perl_using_listutil"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 23, 2019] <a target="_blank" href="http://ods.com.ua/win/eng/program/Perl5Unleashed/ch4.phtml#WhatIsaPerlModule">Introduction to   Perl Modules</a></h4>

<blockquote>
<h6>Nov 23, 2019 |  <a target="_blank" href= "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch4.phtml#WhatIsaPerlModule">ods.com.ua</a></h6>
 

    <p><b>CONTENTS</b></p>

    <ul>
      <li><a target="_blank" href=
      "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch4.phtml#WhatIsaPerlModule">What Is a Perl
      Module?</a></li>

      <li><a target="_blank" href=
      "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch4.phtml#UsingPerlModulesusevsrequire">Using
      Perl Modules: use vs. require</a></li>

      <li><a target="_blank" href=
      "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch4.phtml#TheSampleLetterpmModule">The
      Sample Letter.pm Module</a></li>

      <li><a target="_blank" href=
      "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch4.phtml#SubroutinesandPassingParameters">Subroutines
      and Passing Parameters</a></li>

      <li>
        <a target="_blank" href=
        "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch4.phtml#AnotherSampleModuleFinance">Another
        Sample Module: Finance</a>

        <ul>
          <li><a target="_blank" href=
          "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch4.phtml#ReturnedValuesfromSubroutinesinaPa">
          Returned Values from Subroutines in a Package</a></li>
        </ul>
      </li>

      <li><a target="_blank" href=
      "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch4.phtml#MultipleInheritance">Multiple
      Inheritance</a></li>

      <li>
        <a target="_blank" href=
        "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch4.phtml#ThePerlModuleLibraries">The
        Perl Module Libraries</a>

        <ul>
          <li><a target="_blank" href=
          "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch4.phtml#ExtensionModules">Extension
          Modules</a></li>

          <li><a target="_blank" href=
          "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch4.phtml#WhatIsCPAN">What Is
          CPAN?</a></li>
        </ul>
      </li>

      <li><a target="_blank" href=
      "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch4.phtml#Summary">Summary</a></li>
    </ul>
    <hr>

    <p>This chapter introduces you to the concepts behind references to Perl modules, packages, and
    classes. It also shows you how to create a few sample modules.</p><b><a name=
    "WhatIsaPerlModule">What Is a Perl Module?</a></b>

    <p>A Perl module is a set of Perl code that acts like a library of function calls. The term
    <i>module</i> in Perl is synonymous with the word <i>package</i> . Packages are a feature of
    Perl 4, whereas modules are prevalent in Perl 5.</p>

    <p>You can keep all your reusable Perl code specific to a set of tasks in a Perl module.
    Therefore, all the functionality pertaining to one type of task is contained in one file. It's
    easier to build an application on these modular blocks. Hence, the word <i>module</i> applies a
    bit more than <i>package</i> .</p>

    <p>Here's a quick introduction to modules. Certain topics in this section will be covered in
    detail throughout the rest of the book. Read the following paragraphs carefully to get an
    overview of what lies ahead as you write and use your own modules.</p>

    <p>What is confusing is that the terms <i>module</i> and <i>package</i> are used
    interchangeably in all Perl documentation, and <i>these two terms mean the very same thing</i>
    . So when reading Perl documents, just think "package" when you see "module" and vice
    versa.</p>

    <p>So, what's the premise for using modules? Well, modules are there to package (pardon the
    pun) variables, symbols, and interconnected data items together. For example, using global
    variables with very common names such as <tt>$k</tt> , <tt>$j</tt> , or <tt>$i</tt> in a
    program is generally not a good idea. Also, a loop counter, <tt>$i</tt> , should be allowed to
    work independently in two different portions of the code. Declaring <tt>$i</tt> as a global
    variable and then incrementing it from within a subroutine will create unmanageable problems
    with your application code because the subroutine may have been called from within a loop that
    also uses a variable called <tt>$i</tt> . The use of modules in Perl allows variables with the
    same name to be created at different, distinct places in the same program.</p>

    <p>The symbols defined for your variables are stored in an associative array, referred to as a
    <i>symbol table</i> . These symbol tables are unique to a package. Therefore, variables of the
    same name in two different packages can have different values.</p>

    <p>Each module has its own symbol table of all symbols that are declared within it. The symbol
    table basically isolates synonymous names in one module from another. The symbol table defines
    a <i>namespace</i> , that is, a space for independent variable names to exist in. Thus, the use
    of modules, each with its own symbol table, prevents a variable declared in one section from
    overwriting the values of other variables with the same name declared elsewhere in the same
    program.</p>

    <p>As a matter of fact, all variables in Perl belong to a package. The variables in a Perl
    program belong to the <tt>main</tt> package. All other packages within a Perl program either
    are nested within this main package or exist at the same level. There are some truly global
    variables, such as the signal handler array <tt>%SIG</tt> , that are available to all other
    modules in an application program and cannot be isolated via namespaces. Only those variable
    identifiers starting with letters or an underscore are kept in a module's symbol table. All
    other symbols, such as the names <tt>STDIN</tt> , <tt>STDOUT</tt> , <tt>STDERR</tt> ,
    <tt>ARGV</tt> , <tt>ARGVOUT</tt> , <tt>ENV</tt> , <tt>Inc</tt> , and <tt>SIG</tt> are forced to
    be in package <tt>_main.</tt></p>

    <p>Switching between packages affects only namespaces. All you are doing when you use one
    package or another is declaring which symbol table to use as the default symbol table for
    lookup of variable names. Only dynamic variables are affected by the use of symbol tables.
    Variables declared by the use of the <tt>my</tt> keyword are still resolved with the code block
    they happen to reside in and are not referenced through symbol tables. In fact, the scope of a
    package declaration remains active only within the code block it is declared in. Therefore, if
    you switch symbol tables by using a package within a subroutine, the original symbol table in
    effect when the call was made will be restored when the subroutine returns.</p>

    <p>Switching symbol tables affects only the default lookup of dynamic variable names. You can
    still explicitly refer to variables, file handles, and so on in a specific package by
    prepending a <tt><i>packageName</i> ::</tt> to the variable name. You saw what a <i>package
    context</i> was when using references in <a target="_blank" href=
    "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch3.phtml">Chapter 3</a> . A package context
    simply implies the use of the symbol table by the Perl interpreter for resolving variable names
    in a program. By switching symbol tables, you are switching the package context.</p>

    <p>Modules can be nested within other modules. The nested module can use the variables and
    functions of the module it is nested within. For nested modules, you would have to use
    <tt><i>moduleName</i> :: <i>nestedModuleName</i></tt> and so on. Using the double colon (
    <tt>::</tt> ) is synonymous with using a back quote ( <tt>`</tt> ). However, the double colon
    is the preferred, future way of addressing variables within modules.</p>

    <p>Explicit addressing of module variables is always done with a complete reference. For
    example, suppose you have a module, <tt>Investment</tt> , which is the default package in use,
    and you want to address another module, <tt>Bonds</tt> , which is nested within the
    <tt>Investment</tt> module. In this case, you cannot use <tt>Bond::</tt> . Instead, you would
    have to use <tt>Investment::Bond::</tt> to address variables and functions within the
    <tt>Bond</tt> module. Using <tt>Bond::</tt> would imply the use of a package <tt>Bond</tt> that
    is nested within the <tt>main</tt> module and not within the <tt>Investment</tt> module.</p>

    <p>The symbol table for a module is actually stored in an associative array of the module's
    names appended with two colons. The symbol table for a module called <tt>Bond</tt> will be
    referred to as the associative array <tt>%Bond::</tt> . The name for the symbol table for the
    <tt>main</tt> module is <tt>%main::</tt> , and can even be shortened to <tt>%::</tt> .
    Similarly, all nested packages have their symbols stored in associative arrays with double
    colons separating each nesting level. For example, in the <tt>Bond</tt> module that is nested
    within the <tt>Investment</tt> module, the associative array for the symbols in the
    <tt>Bond</tt> module will be named <tt>%Investment::Bond::</tt> .</p>

    <p>A <tt>typeglob</tt> is really a global type for a symbol name. You can perform aliasing
    operations by assigning to a <tt>typeglob</tt> . One or more entries in an associative array
    for symbols will be used when an assignment via a <tt>typeglob</tt> is used. The actual value
    in each entry of the associative array is what you are referring to when you use the <tt>*
    <i>variableName</i></tt> notation. Thus, there are two ways of referring to variable names in a
    package:</p>

    <blockquote>
      <tt>*Investment::money = *Investment::bills;</tt>

      <p><tt>$Investment::{'money'} = $Investment::{'bills'};</tt></p>
    </blockquote>

    <p>In the first method, you are referring to the variables via a <tt>typeglob</tt> reference.
    The use of the symbol table, <tt>%Investment::</tt> , is implied here, and Perl will optimize
    the lookup for symbols <tt>money</tt> and <tt>bills</tt> . This is the faster and preferred way
    of addressing a symbol. The second method uses a lookup for the value of a variable addressed
    by <tt>'money'</tt> and <tt>'bills'</tt> in the associative array used for symbols,
    <tt>%Investment::</tt> explicitly. This lookup would be done dynamically and will not be
    optimized by Perl. Therefore, the lookup will be forced to check the associative array every
    time the statement is executed. As a result, the second method is not efficient and should be
    used only for demonstration of how the symbol table is implemented internally.</p>

    <p>Another example in this statement</p>

    <blockquote>
      <tt>*kamran = *husain;</tt>
    </blockquote>

    <p>causes variables, subroutines, and file handles that are named via the symbol
    <tt>kamran</tt> to also be addressed via the symbol <tt>husain</tt> . That is, all symbol
    entries in the current symbol table with the key <tt>kamran</tt> will now contain references to
    those symbols addressed by the key <tt>husain</tt> . To prevent such a global assignment, you
    can use explicit references. For example, the following statement will let you address the
    contents of <tt>$husain</tt> via the variable <tt>$kamran</tt> :</p>

    <blockquote>
      <tt>*kamran = \$husain;</tt>
    </blockquote>

    <p>However, any arrays such <tt>@kamran</tt> and <tt>@husain</tt> will not be the same. Only
    what the references specified explicitly will be changed. To summarize, when you assign one
    <tt>typeglob</tt> to another, you affect all the entries in a symbol table regardless of the
    type of variable being referred to. When you assign a reference from one variable type to
    another, you are only affecting one entry in the symbol table.</p>

    <p>A Perl module file has the following format:</p>

    <blockquote>
      <tt>package ModuleName;<br>
      ...<br>
      #### <i>Insert module code</i> ####<br>
      ...<br>
      1;</tt>
    </blockquote>

    <p>The filename has to be called <tt>ModuleName.pm</tt> . The name of a module must end in the
    string <tt>.pm</tt> by convention. The <tt>package</tt> statement is the first line of the
    file. The last line of the file must contain the line with the <tt>1;</tt> statement. This in
    effect returns a <tt>true</tt> value to the application program using the module. Not using the
    <tt>1;</tt> statement will not let the module be loaded correctly.</p>

    <p>The <tt>package</tt> statement tells the Perl interpreter to start with a new namespace
    domain. Basically, all your variables in a Perl script belong to a package called <tt>main</tt>
    . Every variable in the <tt>main</tt> package can be referred to as <tt>$main'variable</tt>
    .</p>

    <p>Here's the syntax for such references:</p>

    <blockquote>
      <tt>$packageName'variableName</tt>
    </blockquote>

    <p>The single quote ( <tt>'</tt> ) is synonymous with the double colon ( <tt>::</tt> )
    operator. I cover more uses of the <tt>::</tt> operator in the next chapter. For the time
    being, you must remember that the following two statements are equivalent:</p>

    <blockquote>
      <tt>$packageName'variableName;<br>
      $packageName::variableName;</tt>
    </blockquote>

    <p>The double-colon syntax is considered standard in the Perl world. Therefore, to preserve
    readability, I use the double-colon syntax in the rest of this book unless it's absolutely
    necessary to make exceptions to prove a point.</p>

    <p>The default use of a variable name defers to the current package active at the time of
    compilation. Thus, if you are in the package <tt>Finance.pm</tt> and specify a variable
    <tt>$pv</tt> , the variable is actually equal to <tt>$Finance::$pv</tt> .</p><b><a name=
    "UsingPerlModulesusevsrequire">Using Perl Modules: <tt>use</tt> vs. <tt>require</tt></a></b>

    <p>You include Perl modules in your program by using the <tt>use</tt> or the <tt>require</tt>
    statement. Here's the way to use either of these statements:</p>

    <blockquote>
      <tt>use ModuleName;<br></tt> require ModuleName;
    </blockquote>

    <p>Note that the <tt>.pm</tt> extension is not used in the code shown above. Also note that
    neither statement allows a file to be included more than once in a program. The returned value
    of true ( <tt>1;</tt> ) as the last statement is required to let Perl know that a
    <tt>require</tt> d or <tt>use</tt> d module loaded correctly and lets the Perl interpreter
    ignore any reloads. In general, it's better to use the <tt>use Module;</tt> statement than the
    <tt>require Module;</tt> statement in a Perl program to remain compatible with future versions
    of Perl.</p>

    <p>For modules, you might want to consider continuing to use the <tt>require</tt> statement.
    Here's why: The <tt>use</tt> statement does a little bit more work than the <tt>require</tt>
    statement in that it alters the namespace of the module that includes another module. You want
    this extra update of the namespace to be done in a program. However, when writing code for a
    module, you may not want the namespace to be altered unless it's explicitly required. In this
    event, you will use the <tt>require</tt> statement.</p>

    <p>The <tt>require</tt> statement includes the full pathname of a file in the <tt>@Inc</tt>
    array so that the functions and variables in the module's file are in a known location during
    execution time. Therefore, the functions that are imported from a module are imported via an
    explicit module reference at runtime with the <tt>require</tt> statement. The <tt>use</tt>
    statement does the same thing as the <tt>require</tt> statement because it updates the
    <tt>@Inc</tt> array with full pathnames of loaded modules. The code for the <tt>use</tt>
    function also goes a step further and calls an <tt>import</tt> function in the module being
    <tt>use</tt> d to explicitly load the list of exported functions at compile time, thus saving
    the time required for an explicit resolution of a function name during execution.</p>

    <p>Basically, the <tt>use</tt> statement is equivalent to</p>

    <blockquote>
      <tt>require ModuleName; import ModuleName [list of imported functions];</tt>
    </blockquote>

    <p>The use of the <tt>use</tt> statement does change your program's namespace because the
    imported function names are inserted in the symbol table. The <tt>require</tt> statement does
    not alter your program's namespace. Therefore, the following statement</p>

    <blockquote>
      <tt>use ModuleName ();</tt>
    </blockquote>

    <p>is equivalent to this statement:</p>

    <blockquote>
      <tt>require ModuleName;</tt>
    </blockquote>

    <p>Functions are imported from a module via a call to a function called <tt>import</tt> . You
    can write your own <tt>import</tt> function in a module, or you can use the <tt>Exporter</tt>
    module and use its <tt>import</tt> function. In almost all cases, you will use the
    <tt>Exporter</tt> module to provide an <tt>import</tt> function instead of reinventing the
    wheel. (You'll learn more on this in the next section.) Should you decide not to use the
    <tt>Exporter</tt> module, you will have to write your own <tt>import</tt> function in each
    module that you write. It's much easier to simply use the <tt>Exporter</tt> module and let Perl
    do the work for you.</p><b><a name="TheSampleLetterpmModule">The Sample <tt>Letter.pm</tt>
    Module</a></b>

    <p>The best way to illustrate the semantics of how a module is used in Perl is to write a
    simple module and show how to use it. Let's take the example of a local loan shark, Rudious
    Maximus, who is simply tired of typing the same "request for payment" letters. Being an avid
    fan of computers and Perl, Rudious takes the lazy programmer's approach and writes a Perl
    module to help him generate his memos and letters.</p>

    <p>Now, instead of typing within fields in a memo template file, all he has to do is type a few
    lines to produce his nice, threatening note. Listing 4.1 shows you what he has to type.</p>
    <hr>

    <blockquote>
      <b>Listing 4.1. Using the</b> <tt><b>Letter</b></tt> <b>module.<br></b>
    </blockquote>

    <blockquote>
      <tt>1 #!/usr/bin/perl -w<br>
      2 #<br>
      3 # Uncomment the line below to include the current dir in @Inc.<br>
      4 # push (@Inc, 'pwd');<br>
      5 #<br>
      6 use Letter;<br>
      7<br>
      8 Letter::To("Mr. Gambling Man","The money for Lucky Dog, Race 2");<br>
      9 Letter::ClaimMoneyNice();<br>
      10 Letter::ThankDem();<br>
      11 Letter::Finish();</tt>
    </blockquote>
    <hr>

    <p>The <tt>use Letter;</tt> statement is present to force the Perl interpreter to include the
    code for the module in the application program. The module should be located in the
    <tt>/usr/lib/perl5/</tt> directory, or you can place it in any directory listed in the
    <tt>@Inc</tt> array. The <tt>@Inc</tt> array is the list of directories that the Perl
    interpreter will look for when attempting to load the code for the named module. The commented
    line (number 4) shows how to add the current working directory to include the path. The next
    four lines in the file generate the subject matter for the letter.</p>

    <p>Here's the output from using the <tt>Letter</tt> module:</p>

    <blockquote>
      <tt>To: Mr. Gambling Man<br>
      Fm: Rudious Maximus, Loan Shark<br>
      Dt: Wed Feb 7 10:35:51 CST 1996</tt>

      <p><tt>Re: The money for Lucky Dog, Race 2</tt></p>

      <p><tt>====================================================</tt></p>

      <p><tt>It has come to my attention that your account is<br>
      way over due.<br>
      You gonna pay us soon?<br>
      Or would you like me to come ovah?</tt></p>

      <p><tt>Thanks for your support.</tt></p>

      <p><tt>Sincerely,<br>
      Rudious</tt></p>
    </blockquote>

    <p>The <tt>Letter</tt> module file is shown in Listing 4.2. The name of the package is declared
    in the first line. Because this module's functions will be exported, I use the
    <tt>Exporter</tt> module. Therefore, the statement <tt>use Exporter;</tt> is required to
    inherit functionality from the <tt>Exporter</tt> module. Another required step is putting the
    word <tt>Exported</tt> in the <tt>@ISA</tt> array to allow searching for <tt>Exported.pm</tt>
    .</p>

    <center>
      <table width="80%" bordercolor="#000000" border="1">
        <tr valign="top">
          <td><b>Note</b></td>
        </tr>

        <tr valign="top">
          <td>
            <blockquote>
              The <tt>@ISA</tt> array is a special array within each package. Each item in the
              array lists where else to look for a method if it cannot be found in the current
              package. The order in which packages are listed in the <tt>@ISA</tt> array is the
              order in which Perl searches for unresolved symbols. A class that is listed in the
              <tt>@ISA</tt> array is referred to as the base class of that particular class. Perl
              will cache missing methods found in base classes for future references. Modifying the
              <tt>@ISA</tt> array will flush the cache and cause Perl to look up all methods again.
            </blockquote>
          </td>
        </tr>
      </table>
    </center>

    <p>Let's now look at the code for <tt>Letter.pm</tt> in Listing 4.2.</p>
    <hr>

    <blockquote>
      <b>Listing 4.2. The</b> <tt><b>Letter.pm</b></tt> <b>module.<br></b>
    </blockquote>

    <blockquote>
      <tt>1 package Letter;<br>
      2<br>
      3 require Exporter;<br>
      4 @ISA = (Exporter);<br>
      5<br>
      6 =head1 NAME<br>
      7<br>
      8 Letter - Sample module to generate letterhead for you<br>
      9<br>
      10 =head1 SYNOPSIS<br>
      11<br>
      12 use Letter;<br>
      13<br>
      14 Letter::Date();<br>
      15 Letter::To($name,$company,$address);<br>
      16<br>
      17 Then one of the following:<br>
      18 Letter::ClaimMoneyNice() {<br>
      19 Letter::ClaimMoney();<br>
      20 Letter::ThreatBreakLeg();<br>
      21<br>
      22 Letter::ThankDem();<br>
      23 Letter::Finish();<br>
      24<br>
      25 =head1 DESCRIPTION<br>
      26<br>
      27 This module provides a short example of generating a letter for a<br>
      28 friendly neighborbood loan shark.<br>
      29<br>
      30 The code begins after the "cut" statement.<br>
      31 =cut<br>
      32<br>
      33 @EXPORT = qw( Date,<br>
      34 To,<br>
      35 ClaimMoney,<br>
      36 ClaimMoneyNice,<br>
      37 ThankDem,<br>
      38 Finish );<br>
      39<br>
      40 #<br>
      41 # Print today's date<br>
      42 #<br>
      43 sub Letter::Date {<br>
      44 $date = 'date';<br>
      45 print "\n Today is $date";<br>
      46 }<br>
      47<br>
      48 sub Letter::To {<br>
      49 local($name) = shift;<br>
      50 local($subject) = shift;<br>
      51 print "\n To: $name";<br>
      52 print "\n Fm: Rudious Maximus, Loan Shark";<br>
      53 print "\n Dt: ", `date`;<br>
      54 print "\n Re: $subject";<br>
      55 print "\n\n";<br>
      56 print "\n====================================================\n";<br>
      57 }<br>
      58 sub Letter::ClaimMoney() {<br>
      59 print "\n You owe me money. Get your act together";<br>
      60 print "\n Do you want me to send Bruno over to ";<br>
      61 print "\n collect it , or are you gonna pay up?";<br>
      62 }<br>
      63<br>
      64 sub Letter::ClaimMoneyNice() {<br>
      65 print "\n It is come to my attention that your account is ";<br>
      66 print "\n way over due.";<br>
      67 print "\n You gonna pay us soon..";<br>
      68 print "\n or would you like me to come ovah?";<br>
      69 }<br>
      70<br>
      71 sub Letter::ThreatBreakLeg() {<br>
      72 print "\n apparently letters like these dont help";<br>
      73 print "\n I will have to make an example of you";<br>
      74 print "\n \n See you in the hospital, pal!";<br>
      75 }<br>
      76<br>
      77 sub Letter::ThankDem() {<br>
      78 print "\n\n Thanks for your support";<br>
      79 }<br>
      80<br>
      81 sub Letter::Finish(){<br>
      82 printf "\n\n\n\n Sincerely";<br>
      83 printf "\n Rudious \n ";<br>
      84 }<br>
      85<br>
      86 1;</tt>
    </blockquote>
    <hr>

    <p>Lines containing the equal sign are used for documentation. You must document each module
    for your own reference; Perl modules do not need to be documented, but it's a good idea to
    write a few lines about what your code does. A few years from now, you may forget what a module
    is about. Good documentation is always a must if you want to remember what you did in the
    past!</p>

    <p>I cover documentation styles used for Perl in <a target="_blank" href=
    "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch8.phtml">Chapter 8</a> , "Documenting Perl
    Scripts." For this sample module, the <tt>=head1</tt> statement begins the documentation.
    Everything up to the <tt>=cut</tt> statement is ignored by the Perl interpreter.</p>

    <p>Next, the module lists all the functions exported by this module in the <tt>@EXPORT</tt>
    array. The <tt>@EXPORT</tt> array defines all the function names that can be called by outside
    code. If you do not list a function in this <tt>@EXPORT</tt> array, it won't be seen by
    external code modules.</p>

    <p>Following the <tt>@EXPORT</tt> array is the body of the code, one subroutine at a time.
    After all the subroutines are defined, the final statement <tt>1;</tt> ends the module file.
    <tt>1;</tt> must be the last executable line in the file.</p>

    <p>Let's look at some of the functions defined in this module. The first function to look at is
    the simple <tt>Date</tt> function, lines 43 to 46, which prints the current UNIX date and time.
    There are no parameters to this function, and it doesn't return anything meaningful back to the
    caller.</p>

    <p>Note the use of <tt>my</tt> before the <tt>$date</tt> variable in line 44. The <tt>my</tt>
    keyword is used to limit the scope of the variable to within the <tt>Date</tt> function's curly
    braces. Code between curly braces is referred to as a <i>block</i> . Variables declared within
    a block are limited in scope to within the curly braces. In 49 and 50, the local variables
    <tt>$name</tt> and <tt>$subject</tt> are visible to all functions.</p>

    <p>You can also declare variables with the <tt>local</tt> qualifier. The use of <tt>local</tt>
    allows a variable to be in scope for the current block as well as for other blocks of code
    called from within this block. Thus, a local <tt>$x</tt> declared within one block is visible
    to all subsequent blocks called from within this block and can be referenced. In the following
    sample code, the <tt>ToTitled</tt> function's <tt>$name</tt> variable can be accessed but not
    the data in <tt>$iphone</tt> :</p>

    <blockquote>
      <tt>1 sub Letter::ToTitled {<br>
      2 local($name) = shift;<br>
      3 my($phone) = shift;</tt>
    </blockquote><b><a name="SubroutinesandPassingParameters">Subroutines and Passing
    Parameters</a></b>

    <p>The sample code for <tt>Letter.pm</tt> showed how to extract one parameter at a time. The
    subroutine <tt>To()</tt> takes two parameters to set up the header for the memo.</p>

    <p>Using functions within a module is not any different than using and defining Perl modules
    within the same code file. Parameters are passed by reference unless otherwise specified.
    Multiple arrays passed into a subroutine, if not explicitly dereferenced using the backslash,
    are concatenated.</p>

    <p>The <tt>@_</tt> input array in a function is always an array of scalar values. Passing
    values by reference is the preferred way in Perl to pass a large amount of data into a
    subroutine. ( <a target="_blank" href=
    "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch3.phtml">See Chapter 3</a> ,
    "References.")</p><b><a name="AnotherSampleModuleFinance">Another Sample Module:
    <tt>Finance</tt></a></b>

    <p>The <tt>Finance</tt> module, shown in Listing 4.3, is used to provide simple calculations
    for loan values. Using the <tt>Finance</tt> module is straightforward. All the functions are
    written with the same parameters, as shown in the formula for the functions.</p>

    <p>Let's look at how the future value of an investment can be calculated. For example, if you
    invest some dollars, <tt>$pv</tt> , in a bond that offers a fixed percentage rate, <tt>$r</tt>
    , applied at known intervals for <tt>$n</tt> time periods, what is the value of the bond at the
    time of its expiration? In this case, you'll be using the following formula:</p>

    <blockquote>
      <tt>$fv = $pv * (1+$r) ** $n ;</tt>
    </blockquote>

    <p>The function to get the future value is declared as <tt>FutureValue</tt> . Refer to Listing
    4.3 to see how to use it.</p>
    <hr>

    <blockquote>
      <b>Listing 4.3. Using the</b> <tt><b>Finance</b></tt> <b>module.<br></b>
    </blockquote>

    <blockquote>
      <tt>1 #!/usr/bin/perl -w<br>
      2<br>
      3 push(@Inc,'pwd');<br>
      4 use Finance;<br>
      5<br>
      6 $loan = 5000.00;<br>
      7 $apr = 3.5; # APR<br>
      8 $year = 10; # in years.<br>
      9<br>
      10 # ----------------------------------------------------------------<br>
      11 # Calculate the value at the end of the loan if interest<br>
      12 # is applied every year.<br>
      13 # ----------------------------------------------------------------<br>
      14 $time = $year;<br>
      15 $fv1 = Finance::FutureValue($loan,$apr,$time);<br>
      16 print "\n If interest is applied at end of year";<br>
      17 print "\n The future value for a loan of \$" . $loan . "\n";<br>
      18 print " at an APR of ", $apr , " for ", $time, " years";<br>
      19 printf " is %8.2f \n" , $fv1;<br>
      20<br>
      21 # ----------------------------------------------------------------<br>
      22 # Calculate the value at the end of the loan if interest<br>
      23 # is applied every month.<br>
      24 # ----------------------------------------------------------------<br>
      25 $rate = $apr / 12; # APR<br>
      26 $time = $year * 12; # in months<br>
      27 $fv2 = Finance::FutureValue($loan,$rate,$time);<br>
      28<br>
      29 print "\n If interest is applied at end of each month";<br>
      30 print "\n The future value for a loan of \$" . $loan . "\n";<br>
      31 print " at an APR of ", $apr , " for ", $time, " months";<br>
      32 printf " is %8.2f \n" , $fv2;<br>
      33<br>
      34 printf "\n The difference in value is %8.2f", $fv2 - $fv1;<br>
      35 printf "\n Therefore by applying interest at shorter time periods";<br>
      36 printf "\n we are actually getting more money in interest.\n";</tt>
    </blockquote>
    <hr>

    <p>Here is sample input and output of Listing 4.3.</p>

    <blockquote>
      <tt>$ <b>testme</b></tt>

      <p><tt>If interest is applied at end of year<br>
      The future value for a loan of $5000<br>
      at an APR of 3.5 for 10 years is 7052.99</tt></p>

      <p><tt>If interest is applied at end of each month<br>
      The future value for a loan of $5000<br>
      at an APR of 3.5 for 120 months is 7091.72</tt></p>

      <p><tt>The difference in value is 38.73<br>
      Therefore by applying interest at shorter time periods<br>
      we are actually getting more money in interest.</tt></p>
    </blockquote>

    <p>The revelation in the output is the result of the comparison of values between <tt>$fv1</tt>
    and <tt>$fv2</tt> . The <tt>$fv1</tt> value is calculated with the application of interest once
    every year over the life of the bond. <tt>$fv2</tt> is the value if the interest is applied
    every month at the equivalent monthly interest rate.</p>

    <p>The <tt>Finance.pm</tt> package is shown in Listing 4.4 in its early development stages.</p>
    <hr>

    <blockquote>
      <b>Listing 4.4. The</b> <tt><b>Finance.pm</b></tt> <b>package.<br></b>
    </blockquote>

    <blockquote>
      <tt>1 package Finance;<br>
      2<br>
      3 require Exporter;<br>
      4 @ISA = (Exporter);<br>
      5<br>
      6 =head1 Finance.pm<br>
      7<br>
      8 Financial Calculator - Financial calculations made easy with Perl<br>
      9<br>
      10 =head 2<br>
      11 use Finance;<br>
      12<br>
      13 $pv = 10000.0;<br>
      14<br>
      15 $rate = 12.5 / 12; # APR per month.<br>
      16<br>
      17 $time = 360 ; # months for loan to mature<br>
      18<br>
      19 $fv = FutureValue();<br>
      20<br>
      21 print $fv;<br>
      22<br>
      23 =cut<br>
      24<br>
      25 @EXPORT = qw( FutureValue,<br>
      26 PresentValue,<br>
      27 FVofAnnuity,<br>
      28 AnnuityOfFV,<br>
      29 getLastAverage,<br>
      30 getMovingAverage,<br>
      31 SetInterest);<br>
      32<br>
      33 #<br>
      34 # Globals, if any<br>
      35 #<br>
      36<br>
      37 local $defaultInterest = 5.0;<br>
      38<br>
      39 sub Finance::SetInterest($) {<br>
      40 my $rate = shift(@_);<br>
      41 $defaultInterest = $rate;<br>
      42 printf "\n \$defaultInterest = $rate";<br>
      43 }<br>
      44<br>
      45 # --------------------------------------------------------------------<br>
      46 # Notes:<br>
      47 # 1. The interest rate $r is given in a value of [0-100].<br>
      48 # 2. The $n given in the terms is the rate at which the interest<br>
      49 # is applied.<br>
      50 #<br>
      51 # --------------------------------------------------------------------<br>
      52<br>
      53 # --------------------------------------------------------------------<br>
      54 # Present value of an investment given<br>
      55 # fv - a future value<br>
      56 # r - rate per period<br>
      57 # n - number of period<br>
      58 # --------------------------------------------------------------------<br>
      59 sub Finance::FutureValue($$$) {<br>
      60 my ($pv,$r,$n) = @_;<br>
      61 my $fv = $pv * ((1 + ($r/100)) ** $n);<br>
      62 return $fv;<br>
      63 }<br>
      64<br>
      65 # --------------------------------------------------------------------<br>
      66 # Present value of an investment given<br>
      67 # fv - a future value<br>
      68 # r - rate per period<br>
      69 # n - number of period<br>
      70 # --------------------------------------------------------------------<br>
      71 sub Finance::PresentValue($$$) {<br>
      72 my $pv;<br>
      73 my ($fv,$r,$n) = @_;<br>
      74 $pv = $fv / ((1 + ($r/100)) ** $n);<br>
      75 return $pv;<br>
      76<br>
      77 }<br>
      78<br>
      79 # --------------------------------------------------------------------<br>
      80 # Get the future value of an annuity given<br>
      81 # mp - Monthly Payment of Annuity<br>
      82 # r - rate per period<br>
      83 # n - number of period<br>
      84 # --------------------------------------------------------------------<br>
      85<br>
      86 sub FVofAnnuity($$$) {<br>
      87 my $fv;<br>
      88 my $oneR;<br>
      89 my ($mp,$r,$n) = @_;<br>
      90<br>
      91 $oneR = ( 1 + $r) ** $n;<br>
      92 $fv = $mp * ( ($oneR - 1)/ $r);<br>
      93 return $fv;<br>
      94 }<br>
      95<br>
      96 # --------------------------------------------------------------------<br>
      97 # Get the annuity from the following bits of information<br>
      98 # r - rate per period<br>
      99 # n - number of period<br>
      100 # fv - Future Value<br>
      101 # --------------------------------------------------------------------<br>
      102<br>
      103 sub AnnuityOfFV($$$) {<br>
      104 my $mp; # mp - Monthly Payment of Annuity<br>
      105 my $oneR;<br>
      106 my ($fv,$r,$n) = @_;<br>
      107<br>
      108 $oneR = ( 1 + $r) ** $n;<br>
      109 $mp = $fv * ( $r/ ($oneR - 1));<br>
      110 return $mp;<br>
      111 }<br>
      112<br>
      113 # --------------------------------------------------------------------<br>
      114 # Get the average of the last "n" values in an array.<br>
      115 # --------------------------------------------------------------------<br>
      116 # The last $count number of elements from the array in @values<br>
      117 # The total number of elements in @values is in $number<br>
      118 #<br>
      119 sub getLastAverage($$@) {<br>
      120 my ($count, $number, @values) = @_;<br>
      121 my $i;<br>
      122<br>
      123 my $a = 0;<br>
      124 return 0 if ($count == 0);<br>
      125 for ($i = 0; $i< $count; $i++) {<br>
      126 $a += $values[$number - $i - 1];<br>
      127 }<br>
      128 return $a / $count;<br>
      129 }<br>
      130<br>
      131 # --------------------------------------------------------------------<br>
      132 # Get a moving average of the values.<br>
      133 # --------------------------------------------------------------------<br>
      134 # The window size is the first parameter, the number of items in the<br>
      135 # passed array is next. (This can easily be calculated within the<br>
      136 # function using the scalar() function, but the subroutine shown here<br>
      137 # is also being used to illustrate how to pass pointers.) The reference to the<br>
      138 # array of values is passed next, followed by a reference to the place<br>
      139 # the return values are to be stored.<br>
      140 #<br>
      141 sub getMovingAve($$\@\@) {<br>
      142 my ($count, $number, $values, $movingAve) = @_;<br>
      143 my $i;<br>
      144 my $a = 0;<br>
      145 my $v = 0;<br>
      146<br>
      147 return 0 if ($count == 0);<br>
      148 return -1 if ($count > $number);<br>
      149 return -2 if ($count < 2);<br>
      150<br>
      151 $$movingAve[0] = 0;<br>
      152 $$movingAve[$number - 1] = 0;<br>
      153 for ($i=0; $i<$count;$i++) {<br>
      154 $v = $$values[$i];<br>
      155 $a += $v / $count;<br>
      156 $$movingAve[$i] = 0;<br>
      157 }<br>
      158 for ($i=$count; $i<$number;$i++) {<br>
      159 $v = $$values[$i];<br>
      160 $a += $v / $count;<br>
      161 $v = $$values[$i - $count - 1];<br>
      162 $a -= $v / $count;<br>
      163 $$movingAve[$i] = $a;<br>
      164 }<br>
      165 return 0;<br>
      166 }<br>
      167<br>
      168 1;</tt>
    </blockquote>
    <hr>

    <p>Look at the declaration of the function <tt>FutureValue</tt> with <tt>($$$)</tt> . The three
    dollar signs together signify three scalar numbers being passed into the function. This extra
    scoping is present for validating the type of the parameters passed into the function. If you
    were to pass a string instead of a number into the function, you would get a message very
    similar to this one:</p>

    <blockquote>
      <tt>Too many arguments for Finance::FutureValue at ./f4.pl line 15, near "$time)"<br>
      Execution of ./f4.pl aborted due to compilation errors.</tt>
    </blockquote>

    <p>The use of prototypes when defining functions prevents you from sending in values other than
    what the function expects. Use <tt>@</tt> or <tt>%</tt> to pass in an array of values. If you
    are passing by reference, use <tt>\@</tt> or <tt>\%</tt> to show a scalar reference to an array
    or hash, respectively. If you do not use the backslash, all other types in the argument list
    prototype are ignored. Other types of disqualifiers include an ampersand for a reference to a
    function, an asterisk for any type, and a semicolon to indicate that all other parameters are
    optional.</p>

    <p>Now, let's look at the <tt>lastMovingAverage</tt> function declaration, which specifies two
    integers in the front followed by an array. The way the arguments are used in the function is
    to assign a value to each of the two scalars, <tt>$count</tt> and <tt>$number</tt> , whereas
    everything else is sent to the array. Look at the function <tt>getMovingAverage()</tt> to see
    how two arrays are passed in order to get the moving average on a list of values.</p>

    <p>The way to call the <tt>getMovingAverage</tt> function is shown in Listing 4.5.</p>
    <hr>

    <blockquote>
      <b>Listing 4.5. Using the moving average function.<br></b>
    </blockquote>

    <blockquote>
      <tt>1 #!/usr/bin/perl -w<br>
      2<br>
      3 push(@Inc,'pwd');<br>
      4 use Finance;<br>
      5<br>
      6 @values = ( 12,22,23,24,21,23,24,23,23,21,29,27,26,28 );<br>
      7 @mv = (0);<br>
      8 $size = scalar(@values);<br>
      9 print "\n Values to work with = { @values } \n";<br>
      10 print " Number of values = $size \n";<br>
      11<br>
      12 # ----------------------------------------------------------------<br>
      13 # Calculate the average of the above function<br>
      14 # ----------------------------------------------------------------<br>
      15 $ave = Finance::getLastAverage(5,$size,@values);<br>
      16 print "\n Average of last 5 days = $ave \n";<br>
      17<br>
      18 Finance::getMovingAve(5,$size,@values,@mv);<br>
      19 print "\n Moving Average with 5 days window = \n { @mv } \n";</tt>
    </blockquote>
    <hr>

    <p>Here's the output from Listing 4.5:</p>

    <blockquote>
      <tt>Values to work with = { 12 22 23 24 21 23 24 23 23 21 29 27 26 28 }<br>
      Number of values = 14</tt>

      <p><tt>Average of last 5 days = 26.2</tt></p>

      <p><tt>Moving Average with 5 days window =<br>
      { 0 0 0 0 0 19.4 21.8 22 22 21.4 23 23.8 24.2 25.2 }</tt></p>
    </blockquote>

    <p>The <tt>getMovingAverage()</tt> function takes two scalars and then two references to arrays
    as scalars. Within the function, the two scalars to the arrays are dereferenced for use as
    numeric arrays. The returned set of values is inserted in the area passed in as the second
    reference. Had the input parameters not been specified with <tt>\@</tt> for each referenced
    array, the <tt>$movingAve</tt> array reference would have been empty and would have caused
    errors at runtime. In other words, the following declaration is not correct:</p>

    <blockquote>
      <tt>sub getMovingAve($$@@)</tt>
    </blockquote>

    <p>The resulting spew of error messages from a bad function prototype is as follows:</p>

    <blockquote>
      <tt>Use of uninitialized value at Finance.pm line 128.<br>
      Use of uninitialized value at Finance.pm line 128.<br>
      Use of uninitialized value at Finance.pm line 128.<br>
      Use of uninitialized value at Finance.pm line 128.<br>
      Use of uninitialized value at Finance.pm line 128.<br>
      Use of uninitialized value at Finance.pm line 133.<br>
      Use of uninitialized value at Finance.pm line 135.<br>
      Use of uninitialized value at Finance.pm line 133.<br>
      Use of uninitialized value at Finance.pm line 135.<br>
      Use of uninitialized value at Finance.pm line 133.<br>
      Use of uninitialized value at Finance.pm line 135.<br>
      Use of uninitialized value at Finance.pm line 133.<br>
      Use of uninitialized value at Finance.pm line 135.<br>
      Use of uninitialized value at Finance.pm line 133.<br>
      Use of uninitialized value at Finance.pm line 135.<br>
      Use of uninitialized value at Finance.pm line 133.<br>
      Use of uninitialized value at Finance.pm line 135.<br>
      Use of uninitialized value at Finance.pm line 133.<br>
      Use of uninitialized value at Finance.pm line 135.<br>
      Use of uninitialized value at Finance.pm line 133.<br>
      Use of uninitialized value at Finance.pm line 135.<br>
      Use of uninitialized value at Finance.pm line 133.<br>
      Use of uninitialized value at Finance.pm line 135.</tt>

      <p><tt>Values to work with = { 12 22 23 24 21 23 24 23 23 21 29 27 26 28 }<br>
      Number of values = 14</tt></p>

      <p><tt>Average of last 5 days = 26.2</tt></p>

      <p><tt>Moving Average with 5 days window =<br>
      { 0 }</tt></p>
    </blockquote>

    <p>This is obviously not the correct output. Therefore, it's critical that you pass by
    reference when sending more than one array.</p>

    <p>Global variables for use within the package can also be declared. Look at the following
    segment of code from the <tt>Finance.pm</tt> module to see what the default value of the
    <tt>Interest</tt> variable would be if nothing was specified in the input. (The current module
    requires the interest to be passed in, but you can change this.)</p>

    <p>Here's a little snippet of code that can be added to the end of the program shown in Listing
    4.5 to add the ability to set interest rates.</p>

    <blockquote>
      <tt>20 local $defaultInterest = 5.0;<br>
      21 sub Finance::SetInterest($) {<br>
      22 my $rate = shift(@_);<br>
      23 $rate *= -1 if ($rate < 0);<br>
      24 $defaultInterest = $rate;<br>
      25 printf "\n \$defaultInterest = $rate";<br>
      26 }</tt>
    </blockquote>

    <p>The local variable <tt>$defaultInterest</tt> is declared in line 20. The subroutine
    <tt>SetInterest</tt> to modify the rate is declared in lines 21 through 26. The <tt>$rate</tt>
    variable uses the values passed into the subroutine and simply assigns a positive value for it.
    You can always add more error checking if necessary.</p>

    <p>To access the <tt>defaultInterest</tt> variable's value, you could define either a
    subroutine that returns the value or refer to the value directly with a call to the following
    in your application program:</p>

    <blockquote>
      <tt>$Finance::defaultInterest;</tt>
    </blockquote><q><a name="ReturnedValuesfromSubroutinesinaPa">Returned Values from Subroutines
    in a Package</a></q>

    <p>The variable holding the return value from the module function is declared as <tt>my
    variable</tt> . The scope of this variable is within the curly braces of the function only.
    When the called subroutine returns, the reference to <tt>my variable</tt> is returned. If the
    calling program uses this returned reference somewhere, the link counter on the variable is not
    zero; therefore, the storage area containing the returned values is not freed to the memory
    pool. Thus, the function that declares</p>

    <blockquote>
      <tt>my $pv</tt>
    </blockquote>

    <p>and then later returns the value of <tt>$pv</tt> returns a reference to the value stored at
    that location. If the calling routine performs a call like this one:</p>

    <blockquote>
      <tt>Finance::FVofAnnuity($monthly,$rate,$time);</tt>
    </blockquote>

    <p>there is no variable specified here into which Perl stores the returned reference;
    therefore, any returned value (or a list of values) is destroyed. Instead, the call with the
    returned value assigned to a local variable, such as this one:</p>

    <blockquote>
      <tt>$fv = Finance::FVofAnnuity($monthly,$rate,$time);</tt>
    </blockquote>

    <p>maintains the variable with the value. Consider the example shown in Listing 4.6, which
    manipulates values returned by functions.</p>
    <hr>

    <blockquote>
      <b>Listing 4.6. Sample usage of the</b> <tt><b>my</b></tt> <b>function.<br></b>
    </blockquote>

    <blockquote>
      <tt>1 #!/usr/bin/perl -w<br>
      2<br>
      3 push(@Inc,'pwd');<br>
      4 use Finance;<br>
      5<br>
      6 $monthly = 400;<br>
      7 $rate = 0.2; # i.e. 6 % APR<br>
      8 $time = 36; # in months<br>
      9<br>
      10 print "\n# ------------------------------------------------";<br>
      11 $fv = Finance::FVofAnnuity($monthly,$rate,$time);<br>
      12 printf "\n For a monthly %8.2f at a rate of %%%6.2f for %d periods",<br>
      13 $monthly, $rate, $time;<br>
      14 printf "\n you get a future value of %8.2f ", $fv;<br>
      15<br>
      16 $fv *= 1.1; # allow 10 % gain in the house value.<br>
      17<br>
      18 $mo = Finance::AnnuityOfFV($fv,$rate,$time);<br>
      19<br>
      20 printf "\n To get 10 percent more at the end, i.e. %8.2f",$fv;<br>
      21 printf "\n you need a monthly payment value of %8.2f",$mo,$fv;<br>
      22<br>
      23 print "\n# ------------------------------------------------ \n";</tt>
    </blockquote>
    <hr>

    <p>Here is sample input and output for this function:</p>

    <blockquote>
      <tt>$ <b>testme<br></b> # ------------------------------------------------<br>
      For a monthly 400.00 at a rate of % 0.20 for 36 periods<br>
      you get a future value of 1415603.75<br>
      To get 10 percent more at the end, i.e. 1557164.12<br>
      you need a monthly payment value of 440.00<br>
      # ------------------------------------------------</tt>
    </blockquote><b><a name="MultipleInheritance">Multiple Inheritance</a></b>

    <p>Modules implement classes in a Perl program that uses the object-oriented features of Perl.
    Included in object-oriented features is the concept of <i>inheritance</i> . (You'll learn more
    on the object-oriented features of Perl in <a target="_blank" href=
    "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch5.phtml">Chapter 5</a> , "Object-Oriented
    <a target="_blank" href="http://jerasoft.net/">Programming in Perl</a> .") Inheritance means
    the process with which a module inherits the functions from its base classes. A module that is
    nested within another module inherits its parent modules' functions. So inheritance in Perl is
    accomplished with the <tt>::</tt> construct. Here's the basic syntax:</p>

    <blockquote>
      <tt>SuperClass::NextSubClass:: ... ::ThisClass.</tt>
    </blockquote>

    <p>The file for these is stored in <tt>./SuperClass/NextSubClass/</tt> . Each double colon
    indicates a lower-level directory in which to look for the module. Each module, in turn,
    declares itself as a package with statements like the following:</p>

    <blockquote>
      <tt>package SuperClass::NextSubClass;<br>
      package SuperClass::NextSubClass::EvenLower;</tt>
    </blockquote>

    <p>For example, say that you really want to create a <tt>Money</tt> class with two subclasses,
    <tt>Stocks</tt> and <tt>Finance</tt> . Here's how to structure the hierarchy, assuming you are
    in the <tt>/usr/lib/perl5</tt> directory:</p>

    <ol>
      <li>Create a <tt>Money</tt> directory under the <tt>/usr/lib/perl5</tt> directory.</li>

      <li>Copy the existing <tt>Finance.pm</tt> file into the <tt>Money</tt> subdirectory.</li>

      <li>Create the new <tt>Stocks.pm</tt> file in the <tt>Money</tt> subdirectory.</li>

      <li>Edit the <tt>Finance.pm</tt> file to use the line <tt>package Money::Finance</tt> instead
      of <tt>package Finance;</tt> .</li>

      <li>Edit scripts to use <tt>Money::Finance</tt> as the subroutine prefix instead of
      <tt>Finance::</tt> .</li>

      <li>Create a <tt>Money.pm</tt> file in the <tt>/usr/lib/perl5</tt> directory.</li>
    </ol>

    <p>The Perl script that gets the moving average for a series of numbers is presented in Listing
    4.7.</p>
    <hr>

    <blockquote>
      <b>Listing 4.7. Using inheriting modules.<br></b>
    </blockquote>

    <blockquote>
      <tt>1 #!/usr/bin/perl -w<br>
      2 $aa = 'pwd';<br>
      3 $aa .= "/Money";<br>
      4 push(@Inc,$aa);<br>
      5 use Money::Finance;<br>
      6 @values = ( 12,22,23,24,21,23,24,23,23,21,29,27,26,28 );<br>
      7 @mv = (0);<br>
      8 $size = scalar(@values);<br>
      9 print "\n Values to work with = { @values } \n";<br>
      10 print " Number of values = $size \n";<br>
      11 # ----------------------------------------------------------------<br>
      12 # Calculate the average of the above function<br>
      13 # ----------------------------------------------------------------<br>
      14 $ave = Money::Finance::getLastAverage(5,$size,@values);<br>
      15 print "\n Average of last 5 days = $ave \n";<br>
      16 Money::Finance::getMovingAve(5,$size,@values,@mv);<br>
      17 # foreach $i (@values) {<br>
      18 # print "\n Moving with 5 days window = $mv[$i] \n";<br>
      19 # }<br>
      20 print "\n Moving Average with 5 days window = \n { @mv } \n";</tt>
    </blockquote>
    <hr>

    <p>Lines 2 through 4 add the path to the <tt>Money</tt> subdirectory. The <tt>use</tt>
    statement in line 5 now addresses the <tt>Finance.pm</tt> file in the <tt>./Money</tt>
    subdirectory. The calls to the functions within <tt>Finance.pm</tt> are now called with the
    prefix <tt>Money::Finance::</tt> instead of <tt>Finance::</tt> . Therefore, a new subdirectory
    is shown via the <tt>::</tt> symbol when Perl is searching for modules to load.</p>

    <p>The <tt>Money.pm</tt> file is not required. Even so, you should create a template for future
    use. Actually, the file would be required to put any special requirements for initialization
    that the entire hierarchy of modules uses. The code for initialization is placed in the
    <tt>BEGIN()</tt> function. The sample <tt>Money.pm</tt> file is shown in Listing 4.8.</p>
    <hr>

    <blockquote>
      <b>Listing 4.8. The superclass module for</b> <tt><b>Finance.pm</b></tt> <b>.<br></b>
    </blockquote>

    <blockquote>
      <tt>1 package Money;<br>
      2 require Exporter;<br>
      3<br>
      4 BEGIN {<br>
      5 printf "\n Hello! Zipping into existence for you\n";<br>
      6 }<br>
      7 1;</tt>
    </blockquote>
    <hr>

    <p>To see the line of output from the <tt>printf</tt> statement in line 5, you have to insert
    the following commands at the beginning of your Perl script:</p>

    <blockquote>
      <tt>use Money;<br>
      use Money::Finance;</tt>
    </blockquote>

    <p>To use the functions in the <tt>Stocks.pm</tt> module, you use this line:</p>

    <blockquote>
      <tt>use Money::Stocks;</tt>
    </blockquote>

    <p>The <tt>Stocks.pm</tt> file appears in the <tt>Money</tt> subdirectory and is defined in the
    same format as the <tt>Finance.pm</tt> file, with the exceptions that <tt>use Stocks</tt> is
    used instead of <tt>use Finance</tt> and the set of functions to export is
    different.</p><b><a name="ThePerlModuleLibraries">The Perl Module Libraries</a></b>

    <p>A number of modules are included in the Perl distribution. Check the
    <tt>/usr/lib/perl5/lib</tt> directory for a complete listing after you install Perl. There are
    two kinds of modules you should know about and look for in your Perl 5 release, Pragmatic and
    Standard modules.</p>

    <p>Pragmatic modules, which are also like pragmas in C compiler directives, tend to affect the
    compilation of your program. They are similar in operation to the preprocessor elements of a C
    program. Pragmas are locally scoped so that they can be turned off with the <tt>no</tt>
    command. Thus, the command</p>

    <blockquote>
      <tt>no POSIX ;</tt>
    </blockquote>

    <p>turns off the <tt>POSIX</tt> features in the script. These features can be turned back on
    with the <tt>use</tt> statement.</p>

    <p>Standard modules bundled with the Perl package include several functioning packages of code
    for you to use. Refer to appendix B, "Perl Module Archives," for a complete list of these
    standard modules.</p>

    <p>To find out all the <tt>.pm</tt> modules installed on your system, issue the following
    command. (If you get an error, add the <tt>/usr/lib/perl5</tt> directory to your path.)</p>

    <blockquote>
      <tt>find /usr/lib/perl5 -name perl "*.pm" -print</tt>
    </blockquote><q><a name="ExtensionModules">Extension Modules</a></q>

    <p>Extension modules are written in C (or a mixture of Perl and C) and are dynamically loaded
    into Perl if and when you need them. These types of modules for dynamic loading require support
    in the kernel. Solaris lets you use these modules. For a Linux machine, check the installation
    pages on how to upgrade to the ELF format binaries for your Linux kernel.</p><q><a name=
    "WhatIsCPAN">What Is CPAN?</a></q>

    <p>The term CPAN (Comprehensive Perl Archive Network) refers to all the hosts containing copies
    of sets of data, documents, and Perl modules on the Net. To find out about the CPAN site
    nearest you, search on the keyword <i>CPAN</i> in search engines such as Yahoo!, AltaVista, or
    Magellan. A good place to start is the <tt>www.metronet.com site</tt> .</p><b><a name=
    "Summary">Summary</a></b>

    <p>This chapter introduced you to Perl 5 modules and described what they have to offer. A more
    comprehensive list is found on the Internet via the addresses shown in the Web sites
    <tt><a target="_blank" href=
    "http://ods.com.ua/win/eng/program/Perl5Unleashed/tppmsgs/msgs0.phtml#13">http://www.metronet.com</a></tt>
    and <tt><a target="_blank" href=
    "http://ods.com.ua/win/eng/program/Perl5Unleashed/tppmsgs/msgs0.phtml#3">http://www.perl.com</a></tt>
    .</p>

    <p>A Perl package is a set of Perl code that looks like a library file. A Perl module is a
    package that is defined in a library file of the same name. A module is designed to be
    reusable. You can do some type checking with Perl function prototypes to see whether parameters
    are being passed correctly. A module has to export its functions with the <tt>@EXPORT</tt>
    array and therefore requires the <tt>Exporter</tt> module. Modules are searched for in the
    directories listed in the <tt>@Inc</tt> array.</p>

    <p>Obviously, there is a lot more to writing modules for Perl than what is shown in this
    chapter. The simple examples in this chapter show you how to get started with Perl modules. In
    the rest of the book I cover the modules and their features, so hang in there.</p>

    <p>I cover Perl objects, classes, and related concepts in <a target="_blank" href=
    "http://ods.com.ua/win/eng/program/Perl5Unleashed/ch5.phtml">Chapter 5</a> .</p>
    
 <!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_modules.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191123X_introduction_to_perl_modules"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191123X_min_max_sum_in_perl_using_listutil" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191121X_tux_nl_style_and_layout"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 23, 2019] <a target="_blank" href="https://perlmaven.com/min-max-sum-using-list-util">min, max, sum in Perl using ListUtil</a></h4>

<h5>See also <a target="_blank" href="https://metacpan.org/pod/List::MoreUtils">ListMoreUtils -
  Provide the stuff missing in ListUtil - metacpan.org</a></h5>
<blockquote>
<h6>Nov 23, 2019 |  <a target="_blank" href= "https://perlmaven.com/min-max-sum-using-list-util">perlmaven.com</a></h6>
 
 <a target="_blank" href="https://metacpan.org/pod/List::Util">List::Util</a> module provides a number of simple
    and some more complex functions that can be used on lists, anything that returns a list
    anything that can be seen as a list.

    <p>For example these can be used on arrays as they "return their content" in <a target="_blank" href="https://perlmaven.com/m/scalar-and-list-context-in-perl">list context</a> .
    <b>min</b></p>

    <p>If given a list of numbers to it, it will return the smallest number:</p>

    <p><b>examples/min.pl</b><br></p>

    <ol>
      <li>use 5.010 ;</li>

      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use List :: Util qw ( min );</li>

      <li>say min ( 10 , 3 , - 8 , 21 ); # -8</li>

      <li>my @prices = ( 17.2 , 23.6 , 5.50 , 74 , '10.3' );</li>

      <li>say min ( @prices ); # 5.5</li>

      <li># Argument "2x" isn't numeric in subroutine entry at examples/min.pl line 14.</li>

      <li>say min ( 10 , 3 , '2x' , 21 ); # 2</li>
    </ol>

    <p>If one of the arguments is a string that cannot be fully converted to a number automatically
    and if you have <a target="_blank" href="https://perlmaven.com/always-use-warnings">use
    warnings on as you should</a> , then you'll see the following warnings: Argument ... isn't
    numeric in subroutine entry at ...</p><b>minstr</b>

    <p>There is a corresponding function called minstr that will accept strings and sort them
    according to the ASCII order, though I guess it will work with Unicode as well if that's what
    you are feeding it.</p><a target="_blank" href="https://leanpub.com/collab-dev-git/"><img src=
    "https://perlmaven.com/img/git_book_cover_306x396.png"></a> <b>examples/minstr.pl</b><br>

    <ol>
      <li>use 5.010 ;</li>

      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use List :: Util qw ( minstr );</li>

      <li>say minstr ( 'f' , 'b' , 'e' ); # b</li>
    </ol>

    <p>It can also accept numbers as parameters and will treat them as strings. The result might
    surprise you, if you are not familiar with the automatic number to string conversion of Perl,
    and that the string "11" is ahead of the string "2" because the comparison works
    character-by-character and in this case the first character of "11" is ahead of the first (and
    only) character of "2" in the ASCII table.</p>

    <p><b>examples/minstr_numbers.pl</b><br></p>

    <ol>
      <li>use 5.010 ;</li>

      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use List :: Util qw ( minstr );</li>

      <li>say minstr ( 2 , 11 , 99 ); # 11</li>
    </ol>

    <p>After all internally it uses the lt operator.</p><b>max</b>

    <p>Similar to min just returns the biggest number.</p><b>maxstr</b>

    <p>Similar to minstr , returns the biggest string in ASCII order.</p><b>sum</b>

    <p>The sum function adds up the provided numbers and returns their sum. If one or more of the
    values provided is a string that cannot be fully converted to a number it will generate a
    warning like this: Argument ... isn't numeric in subroutine entry at ... . If the parameters of
    sum are empty the function returns <a target="_blank" href=
    "https://perlmaven.com/undef">undef</a> . This is unfortunate as it should be 0, but in order
    to provide backwards compatibility, if the provided list is empty then undef is returned.</p>

    <p><b>examples/sum.pl</b><br></p>

    <ol>
      <li>use 5.010 ;</li>

      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use List :: Util qw ( sum );</li>

      <li>say sum ( 10 , 3 , - 8 , 21 ); # 26</li>

      <li>my @prices = ( 17.2 , 23.6 , '1.1' );</li>

      <li>say sum ( @prices ); # 41.9</li>

      <li>my @empty ;</li>

      <li># Use of uninitialized value in say at examples/sum.pl line 14.</li>

      <li>say sum ( @empty ); # (prints nothing)</li>
    </ol><b>sum0</b>

    <p>In order to fix the above issue, that sum() return undef , in version 1.26 of the module, in
    2012, a new function called sum0 was introduced that behaves exactly like the sum function, but
    returns 0 if no values was supplied.</p>

    <p><b>examples/sum0.pl</b><br></p>

    <ol>
      <li>use 5.010 ;</li>

      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use List :: Util qw ( sum0 );</li>

      <li>say sum0 ( 10 , 3 , - 8 , 21 ); # 26</li>

      <li>my @prices = ( 17.2 , 23.6 , '1.1' );</li>

      <li>say sum0 ( @prices ); # 41.9</li>

      <li>my @empty ;</li>

      <li>say sum0 ( @empty ); # 0</li>
    </ol><b>product</b>

    <p>The product function multiplies its parameters. As this function is newer it was not
    constrained with backward compatibility issues so if the provided list is empty, the returned
    value will be 1.</p>

    <p><b>examples/product.pl</b><br></p>

    <ol>
      <li>use 5.010 ;</li>

      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use List :: Util qw ( product );</li>

      <li>my @interest = ( 1.2 , 2.6 , 4 , '1.3' );</li>

      <li>say product ( @interest ); # 16.224</li>

      <li>my @empty ;</li>

      <li>say product ( @empty ); # 1</li>
    </ol><b>Other functions of List::Util</b>

    <p>The module has a number of other functions that were used in various other
    articles:</p><b>first</b>

    <p>first returns the first element from a list that satisfies the given condition. For examples
    on how to use it an why is it good check out the articles <a target="_blank" href=
    "https://perlmaven.com/fast-lookup-by-name-or-by-date">Fast lookup by name or by date - Array -
    Hash - Linked List</a> and <a target="_blank" href=
    "https://perlmaven.com/search-for-hash-in-array-of-hashes">Search for hash in an array of
    hashes</a> .</p><b>any</b>

    <p>The any function will return <a target="_blank" href=
    "https://perlmaven.com/boolean-values-in-perl">true</a> if any of the given values satisfies
    the given condition. It is shown in the article <a target="_blank" href=
    "https://perlmaven.com/filtering-values-with-perl-grep">Filtering values using Perl grep</a> as
    a better solution.</p>

    <p>It is also used in the example showing how to <a target="_blank" href=
    "https://perlmaven.com/is-any-create-test-module">create a testing module</a> and how to
    <a target="_blank" href=
    "https://perlmaven.com/is-any-to-test-multiple-expected-values">implement 'is_any' to test
    multiple expected values</a> .</p><b>all</b>

    <p>The all function will return <a target="_blank" href=
    "https://perlmaven.com/boolean-values-in-perl">true</a> if all the supplied values satisfy the
    given condition. It can be seen in the article <a target="_blank" href=
    "https://perlmaven.com/check-several-regexes-on-many-strings">Check several regexes on many
    strings</a> .</p><b>reduce</b>

    <p>The reduce function might be familiar to you from the <a target="_blank" href=
    "https://en.wikipedia.org/wiki/MapReduce">MapReduce</a> programming model that was lauded
    around "BigData". It makes it provides a way to summarize data in an easy way. <a target=
    "_blank" href="https://perlmaven.com/factorial-in-perl">Implementing factorial in Perl - n!</a>
    is a good and simple example. It is also used in the <a target="_blank" href=
    "https://perlmaven.com/fast-lookup-by-name-or-by-date">Fast lookup by name or by date - Array -
    Hash - Linked List</a> article.</p>
 <!--TAGS: .  -->

<!--file:///f:/Public_html/Scripting/Perlorama/perl_subroutnes_and_functions.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191123X_min_max_sum_in_perl_using_listutil"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191121X_tux_nl_style_and_layout" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191121X_replaying_debugger_commands_from_history"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 21, 2019] <a target="_blank" href="http://tux.nl/style.html">Tux.nl - Style and   Layout</a></h4>

<blockquote>
<h6>Nov 21, 2019 |  <a target="_blank" href="http://tux.nl/style.html">tux.nl</a></h6>
 

    <p><b>Why my style is best better</b></p>

    <p>I will try to explain the logic behind the style decisions taken over that last 35+ years of
    programming in different languages.</p>

    <p>About programming style and layout there are as many opinions as there are people. Most
    important in my opinion is to <i>think</i> about the reasoning behind what you, your team or
    your company chooses to follow as guides.</p>

    <p>I seriously think that way too many (young) programmers leave school, brainwashed with
    GNU-style coding without realizing that the amount of indentation and the placing of braces,
    brackets and parentheses were well thought about.</p>

    <p>Several well known styles (including mine) are discussed at <a target="_blank" href=
    "https://secure.wikimedia.org/wikipedia/en/wiki/Indent_style">wikimedia</a> . It is worth
    reading through them to see the pros and cons of each.</p>

    <p>For me personally, the GNU coding style is one of the reasons I do <i>NOT</i> contribute a
    lot to these projects. The style does not fit my logic, and if I send patches that are rejected
    simply because I wrote them in a style/layout that I think is way better because I then
    understand the underlying logic, I give up.</p>

    <p>Here I will take a tour through what I think is the only correct way of (perl) code layout,
    and why. Most of this can be achieved with <a target="_blank" href=
    "http://search.cpan.org/dist/Perl-Tidy">Perl::Tidy</a> and a correct <a target="_blank" href=
    "http://tux.nl/Files/.perltidyrc">.perltidyrc</a> . I'll use their configuration definitions as
    a guide.</p>

    <dl>
      <dt>Indentation in code blocks</dt>

      <dt>Opening Block Brace Right or Left</dt>

      <dt>Braces Left</dt>

      <dd>
        Because braces are just syntactic sugar to keep a block together, it should visually also
        bind to the block, and not to the conditional. As the closing brace - or <code>END</code>
        in languages like PASCAL - is visually showing me the end of the block, it should obviously
        have the same indent as the block itself. An advantage is that the alignment of the closing
        brace with the block emphasizes the fact that the entire block is conceptually (as well as
        programmatically) a single compound statement.<br>
        In other words: I see the braces being part of the block, and as all statements inside a
        block share the same indentation, in my opinion the brace - being part of the block -
        should have the same indentation too.

        <ul>
          <li>Indent width is 4, tabs are allowed (when set to 8). I prefer having it being spaces
          only, but as I cannot <i>see</i> the difference with good editors, I do not really
          care.</li>

          <li>Opening brace should be on the same line as the conditional</li>

          <li>Block should be indented</li>

          <li>Closing brace should have the same indent as the block</li>
        </ul>
        <pre>
  if ($flag eq "a") {
      $anchor = $header;
      }
</pre>This style is also referred to as <a target="_blank" href=
"https://en.wikipedia.org/wiki/Indent_style#Ratliff_style">Ratliff style</a> on wikipedia or
<a target="_blank" href="https://secure.wikimedia.org/wikipedia/en/wiki/Indent_style#Banner_style">
        Banner style</a> on wikimedia.
      </dd>

      <dt>Continuation Indentation</dt>

      <dd>
        <pre>
  if ($flag eq "a") {
      $anchor = substr ($header, 0, 6) .
                substr ($char_list, $place_1, 1) .
                substr ($char_list, $place_2, 1);
      }
</pre>
      </dd>

      <dd>
        Or, also acceptable:
        <pre>
  if ($flag eq "a") {
      $anchor =
          substr ($header, 0, 6) .
          substr ($char_list, $place_1, 1) .
          substr ($char_list, $place_2, 1);
      }
</pre>
      </dd>

      <dt>Braces Right</dt>

      <dd>
        <pre>
  if ($bigwasteofspace1 && $bigwasteofspace2 ||
      $bigwasteofspace3 && $bigwasteofspace4) {
      big_waste_of_time ();
      }
</pre>
      </dd>

      <dd>
        also acceptable:
        <pre>
  if (   $bigwasteofspace1 && $bigwasteofspace2
      || $bigwasteofspace3 && $bigwasteofspace4) {
      big_waste_of_time ();
      }
</pre>
      </dd>

      <dd>
        also acceptable:
        <pre>
  if (  $bigwasteofspace1 && $bigwasteofspace2 ||
        $bigwasteofspace3 && $bigwasteofspace4) {
      big_waste_of_time ();
      }
</pre>
      </dd>

      <dt>(No) Cuddled Else</dt>

      <dd>
        Of course cuddled else is not the way to go, as it makes removing either branch more
        difficult and makes the indent of the closing brace go wrong. The only right way to use
        if/else indent is uncuddled:
        <pre>
  if ($flag eq "h") {
      $headers = 0;
      }
  elsif ($flag eq "f") {
      $sectiontype = 3;
      }
  else {
      print "invalid option: " . substr ($arg, $i, 1) . "\n";
      dohelp ();
      }
</pre>
      </dd>

      <dt>Vertical tightness</dt>

      <dd>
        <pre>
  sub _directives
  {
      {   ENDIF => \&_endif,
          IF    => \&_if,
          };
      } # _directives
</pre>the opening brace of a sub may optionally be put on a new line. If so, it should be in column
one, for all those that use 'vi' or one of it's clones, so }, {, ]], and [[ work as expected.<br>

        if the opening brace is on the same line, which I prefer, it requires a single leading
        space
        <pre>
  sub _directives {
      {   ENDIF => \&_endif,
          IF    => \&_if,
          };
      } # _directives
</pre>
      </dd>

      <dt>Indentation Style for Other Containers</dt>

      <dt>Opening Vertical Tightness</dt>

      <dd>
        <pre>
  $dbh = DBI->connect (undef, undef, undef, {
      PrintError => 0,
      RaiseError => 1,
      });
</pre>
      </dd>

      <dd>
        <pre>
  if (!defined (start_slip ($DEVICE, $PHONE,  $ACCOUNT, $PASSWORD,
                            $LOCAL,  $REMOTE, $NETMASK, $MTU)) &&
       $continuation_flag) {
      do_something_about_it ();
      }
</pre>
      </dd>

      <dt>Closing Token Placement</dt>

      <dd>
        <pre>
  my @month_of_year = ( "Jan", "Feb", "Mar", "Apr", "May", "Jun",
                        "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
                        );
</pre>
      </dd>

      <dd>
        also acceptable:
        <pre>
  my @month_of_year = (qw(
      Jan Feb Mar Apr May Jun
      Jul Aug Sep Oct Nov Dec
      ));
</pre>As with the closing brace of a block, the closing parenthesis belongs to the data in the
container it closes, and thus should have the same indentation.
      </dd>

      <dt>Define Horizontal Tightness</dt>

      <dd>
        Of course <code>function <space> <paren> <no-space> <first-arg>
        <comma> <space></code>
        <pre>
  if ((my $duration = travel ($target, $means)) > 1200) {
</pre>One of my pet-peeves. Having white-space between the function name and its opening
parenthesis is the best match to how we think. As an example, if I would ask someone to describe
his/her day, he/she might answer
        <pre>
  I woke up
  I freshened myself
  I had breakfast
  I got to work
  I worked
  I had lunch
  I worked again
  I went home
  I had diner
  I watched TV
  I brushed my teeth
  I went to bed
</pre>In computer-speak
        <pre>
  wake_up ();
  wash ($self);
  eat ("breakfast");
  goto ("work")
  work ();
  eat ("lunch");
  work ();
  goto ("home");
  eat ("diner");
  watch_tv ();
  wash ($teeth);
  sleep ();
</pre>In which the seasoned programmer might see
        <pre>
  for $day in (qw( Mon Tue Wed Thu Fri )) {
     wake_up ();
     wash ($self);
     eat ("breakfast");
     :
     :
</pre>Or, more extreme to show the sequence of <b>actions</b>
        <pre>
  for $day in (qw( Mon Tue Wed Thu Fri )) {
     wake_up ();
     wash    ($self);
     eat     ("breakfast");
     :
     :
</pre>Where it, IMHO, clearly shows that the actions are far more important than what it takes to
perform the action. When I read through the process, I don't care about what transport the person
uses to get to work and if eggs are part of the breakfast. These are the parameters to the actions
        <pre>
  for $day in (qw( Mon Tue Wed Thu Fri )) {
     wake_up ();
     wash    ($day eq "Fri" ? "bath" : "shower", water_temp => "47");
     eat     (type   => "breakfast", eggs  => 2, toast => 4, Tea => "yes");
     travel  (target => $work,       means => "train");
     :
     :
</pre>I will only have a look at the function's argument if I need to. In reading that I <code>
        eat</code> , I see what <b>action</b> is taken. That's enough for understanding the program
        flow. The arguments to the function have to be grouped together using parenthesis for the
        function to know that all the arguments are for the function: the parenthesis are there to
        group the arguments, not to make the function a function so the parenthesis belong to the
        arguments and not to the function and therefor are to be close to the arguments ant not to
        the function.<br>
        Arguments are separated by a comma <b>and</b> a space, just to separate the arguments more
        for better readability
        <pre>
  my $width = $col[$j + $k] - $col[$j];

  my %bf = map { $_ => -M $_ } grep { m/\.deb$/ } dirents ".";
</pre>
      </dd>

      <dt>Statement modifiers</dt>

      <dd>
        <pre>
  $work_done and go_home ();
</pre>A rule of thumb is to NEVER use statement modifiers like
        <pre>
  go_home () unless $work_done; # WRONG!
</pre>As it will draw the attention to going home (unconditionally) instead of to the condition,
which is more important. This is especially annoying when using exit, die, croak or return. Any of
these will visually end the current scope, so you do not have to read on. Unless there is a
statement modifier and you need to re-read the entire section.
      </dd>

      <dt>No else after return/exit/die/croak/throw</dt>

      <dd>
        <pre>
  if (expression) {
      return;
      }
  else {
      return 42;
      }
</pre>As any of return, exit, die, croak, or throw will immediately exit the current scope, the
mind will read the code as to stop processing it right there, which is exactly what those keywords
are for.<br>
        In an if/else construct, the code <b>after</b> the construct is supposed to be executed
        when either if the if/else branches where followed. If the if-branch exits the current
        scope, there is no need to run the code after the construct, so the else is useless.<br>
        This is the main reason why these keywords should <b>never</b> have a statement modifier
        (and no, you cannot come up with a valid exception to this rule).
      </dd>

      <dt>Statement Termination Semicolon Spaces</dt>

      <dd>
        <pre>
  my $i = 1;
</pre>
      </dd>

      <dt>For Loop Semicolon Spaces</dt>

      <dd>
        <pre>
  for (@a = @$ap, $u = shift @a; @a; $u = $v) {
</pre>
      </dd>

      <dt>Block Comment Indentation</dt>

      <dd>
        <ul>
          <li>If comment is aligned to the left margin, leave it there</li>

          <li>If the original comment was indented, match the indent to the surrounding code.</li>

          <li>Never reformat comments itself. Do not wrap</li>
        </ul>
      </dd>

      <dt>Outdenting Long Quotes</dt>

      <dd>
        <pre>
  if ($source_stream) {
      if (@ARGV > 0) {
          die "You may not specify any filenames when a source array is given\n";
          }
      }
</pre>
      </dd>

      <dd>
        <pre>
  if ($source_stream) {
      if (@ARGV > 0) {
          die "You may not specify any filenames ".
              "when a source array is given\n";
          }
      }
</pre>
      </dd>

      <dd>
        <pre>
  for (@methods) {
      push @results, {
          name => $_->name,
          help => $_->help,
          };
      }
</pre>
      </dd>
    </dl>
 <!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_style.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191121X_tux_nl_style_and_layout"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191121X_replaying_debugger_commands_from_history" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191121X_can_the_perl_debugger_save_the_readline_history_to_a_file"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 21, 2019] <a target="_blank" href="https://perlmonks.org/?node_id=11108943">Replaying   debugger commands from history</a></h4>

<blockquote>
<h6>Nov 21, 2019 |  <a target="_blank" href= "https://perlmonks.org/?node_id=11108943">perlmonks.org</a></h6>
 

    <p><b><a target="_blank" href="https://perlmonks.org/?node_id=708738">LanX</a> (Archbishop) on
    Nov 20, 2019 at 15:59 UTC</b></p>

    <blockquote>
      <a target="_blank" href="https://perlmonks.org/?node_id=11108944">Re: Replaying debugger
      commands from history</a>

      <p>Sure!</p>

      <p>Have a look at the docs in <a target="_blank" href=
      "https://perldoc.perl.org/perldebug.html#Debugger-Customization">perldebug#Debugger-Customization</a>
      concerning</p>

      <p><tt>@DB::typeahead</tt></p>

      <p>like</p>

      <p><tt>sub afterinit { push @DB::typeahead, "b 4", "b 6"; }</tt></p>

      <p>IIRC it should be either settable</p>

      <ul>
        <li>in <tt>.perldb</tt></li>

        <li>or in the <tt>-e''</tt> command line option at startup</li>

        <li>(update) or even inside your debugged code inside BEGIN</li>
      </ul>
    </blockquote>
 <!--TAGS: . ~/Perl -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_debugging.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191121X_replaying_debugger_commands_from_history"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191121X_can_the_perl_debugger_save_the_readline_history_to_a_file" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191121X_fast_common_substring_matching"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 21, 2019] <a target="_blank" href="https://stackoverflow.com/questions/6433241/can-the-perl-debugger-save-the-readline-history-to-a-file">   Can the Perl debugger save the ReadLine history to a file?</a></h4>

<blockquote>
<h6>Nov 21, 2019 |  <a target="_blank" href= "https://stackoverflow.com/questions/6433241/can-the-perl-debugger-save-the-readline-history-to-a-file"> stackoverflow.com</a></h6>
 

    <p><a target="_blank" href="https://stackoverflow.com/questions/ask">Ask Question</a> Asked 8
    years, 5 months ago Active <a target="_blank" href=
    "https://stackoverflow.com/questions/6433241/can-the-perl-debugger-save-the-readline-history-to-a-file?lastactivity">
    6 years ago</a> Viewed 941 times 10 2</p>
    <hr noshade align="left" width="10" size="10">

    <p><b><a target="_blank" href="https://stackoverflow.com/users/4940240/eli">eli</a></b> ,Jun 7,
    2018 at 14:13</p>

    <blockquote>
      I work quit a bit with lib ReadLine and the lib Perl Readline.

      <p>Yet, the Perl debugger refuses to save the session command line history.</p>

      <p>Thus, each time I invoke the debugger I lose all of my previous history.</p>

      <p>Does anyone know how to have the Perl debugger save, and hopefully, append session history
      similar to the bash <code>HISTORYFILE</code> ?</p>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/11095/mirod">mirod</a></b> ,Jun
    22, 2011 at 10:31</p>

    <blockquote>
      The way I do this is by having the following line in my <code>~/.perldb</code> file:

      <p><code>&parse_options("HistFile=$ENV{HOME}/.perldb.hist");</code></p>

      <p>Debugger commands are then stored in <code>~/.perldb.hist</code> and accessible across
      sessions.</p>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/17389/ysth">ysth</a></b> ,Jul
    13, 2011 at 9:37</p>

    <blockquote>
      Add <code>parse_options("TTY=/dev/stdin ReadLine=0");</code> to .perldb, then:
      <pre>
rlwrap -H .perl_history perl -d ...
</pre>
    </blockquote>

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/users/1223352/mephinet">mephinet</a></b> ,Feb 21, 2012 at 12:37</p>

    <blockquote>
      <pre>
$ export PERLDB_OPTS=HistFile=$HOME/.perldb.history
</pre>
    </blockquote>

    <p>,</p>

    <blockquote>
      I did the following:

      <p>1) Created <code>~/.perldb</code> , which did not exist previously.</p>

      <p>2) Added <code>&parse_options("HistFile=$ENV{HOME}/.perldb.hist");</code> from mirod's
      answer.</p>

      <p>3) Added <code>export PERLDB_OPTS=HistFile=$HOME/.perldb.history</code> to ~/.bashrc from
      mephinet's answer.</p>

      <p>4) Ran <code>source .bashrc</code></p>

      <p>5) Ran <code>perl -d my program.pl</code> , and got this warning/error</p>
      <pre>
perldb: Must not source insecure rcfile /home/ics/.perldb.
        You or the superuser must be the owner, and it must not 
        be writable by anyone but its owner.
</pre>

      <p>6) I protected <code>~/.perldb</code> with owner rw <code>chmod 700 ~/.perldb</code> , and
      the error went away.</p>
    </blockquote>
 <!--TAGS: . ~/Scripting -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_debugging.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191121X_can_the_perl_debugger_save_the_readline_history_to_a_file"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191121X_fast_common_substring_matching" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191115X_why_do_many_people_assume_oop_is_on_the_decline"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 21, 2019] <a target="_blank" href="https://perlmonks.org/?node_id=485464">Fast common   substring matching</a></h4>

<blockquote>
<h6>Nov 21, 2019 |  <a target="_blank" href= "https://perlmonks.org/?node_id=485464">perlmonks.org</a></h6>
 

    <p>This code was written as a solution to the problem posed in <a target="_blank" href=
    "https://perlmonks.org/?node_id=484593">Search for identical substrings</a> . As best I can
    tell it runs about 3 million times faster than the original code.</p>

    <p>The code reads a series of strings and searches them for the longest substring between any
    pair of strings. In the original problem there were 300 strings about 3K long each. A test set
    comprising 6 strings was used to test the code with the result given below.</p>

    <p>Someone with Perl module creation and publication experience could wrap this up and publish
    it if they wish.</p>
    <pre>
use strict;
use warnings;
use Time::HiRes;
use List::Util qw(min max);

my $allLCS = 1;
my $subStrSize = 8; # Determines minimum match length. Should be a power of 2
# and less than half the minimum interesting match length. The larger this value
# the faster the search runs.

if (@ARGV != 1)
    {
    print "Finds longest matching substring between any pair of test strings\n";
    print "the given file. Pairs of lines are expected with the first of a\n";
    print "pair being the string name and the second the test string.";
    exit (1);
    }

# Read in the strings
my @strings;
while ()
  {
  chomp;
  my $strName = $_;
  $_ = ;
  chomp;
  push @strings, [$strName, $_];
  }

my $lastStr = @strings - 1;
my @bestMatches = [(0, 0, 0, 0, 0)]; # Best match details
my $longest = 0; # Best match length so far (unexpanded)

my $startTime = [Time::HiRes::gettimeofday ()];

# Do the search
for (0..$lastStr)
  {
  my $curStr = $_;
  my @subStrs;
  my $source = $strings[$curStr][1];
  my $sourceName = $strings[$curStr][0];

  for (my $i = 0; $i  0;
        push @localBests, [@test] if $dm >= 0;
        $offset = $test[3] + $test[4];

        next if $test[4]  0;
        push @bestMatches, [@test];
        }
        continue {++$offset;}
      }

    next if ! $allLCS;

    if (! @localBests)
      {
      print "Didn't find LCS for $sourceName and $targetName\n";
      next;
      }

    for (@localBests)
      {
      my @curr = @$_;
      printf "%03d:%03d L[%4d] (%4d %4d)\n",
        $curr[0], $curr[1], $curr[4], $curr[2], $curr[3];
      }
    }
  }

print "Completed in " . Time::HiRes::tv_interval ($startTime) . "\n";
for (@bestMatches)
  {
  my @curr = @$_;
  printf "Best match: %s - %s. %d characters starting at %d and %d.\n",
    $strings[$curr[0]][0], $strings[$curr[1]][0], $curr[4], $curr[2], $curr[3];
  }


sub expandMatch
{
my ($index1, $index2, $str1Start, $str2Start, $matchLen) = @_;
my $maxMatch = max (0, min ($str1Start, $subStrSize + 10, $str2Start));
my $matchStr1 = substr ($strings[$index1][1], $str1Start - $maxMatch, $maxMatch);
my $matchStr2 = substr ($strings[$index2][1], $str2Start - $maxMatch, $maxMatch);

($matchStr1 ^ $matchStr2) =~ /\0*$/;
my $adj = $+[0] - $-[0];
$matchLen += $adj;
$str1Start -= $adj;
$str2Start -= $adj;

return ($index1, $index2, $str1Start, $str2Start, $matchLen);
}



</pre>

    <p>Output using <a target="_blank" href="https://perlmonks.org/?node=bioMan">bioMan</a> 's six
    string sample:</p><tt>Completed in 0.010486 Best match: >string 1 - >string 3 . 1271
    characters starting at 82 an + d 82.</tt> <a target="_blank" href=
    "https://perlmonks.org/?abspart=1;part=2;displaytype=displaycode;node_id=485464">[download]</a>
    
 <!--TAGS: . ~/Perl -->
 <!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191121X_fast_common_substring_matching"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191115X_why_do_many_people_assume_oop_is_on_the_decline" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191115X_why_is_perl_so_hated_and_still_commonly_used_and_why_should_i_learn_it"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 15, 2019] <a target="_blank" href="https://www.quora.com/Why-do-many-people-assume-OOP-is-on-the-decline">Why do many people assume   OOP is on the decline?</a></h4>

<blockquote>
<h6>Nov 15, 2019 |  <a target="_blank" href= "https://www.quora.com/Why-do-many-people-assume-OOP-is-on-the-decline">www.quora.com</a></h6>
 

    <p><a target="_blank" href="https://www.quora.com/profile/Daniel-Korenblum"><img src=
    "https://qph.fs.quoracdn.net/main-thumb-10977604-100-npbelpiziucxzkegjhvfuxjlbgbbaluz.jpeg"
    alt="Daniel Korenblum"></a></p>

    <p><a target="_blank" href="https://www.quora.com/profile/Daniel-Korenblum">Daniel
    Korenblum</a> , works at Bayes Impact <a target="_blank" href=
    "https://www.quora.com/Why-do-many-people-assume-OOP-is-on-the-decline/answer/Daniel-Korenblum">
    Updated May 25, 2015</a> There are many reasons why non-OOP languages and paradigms/practices
    are on the rise, contributing to the relative decline of OOP.</p>

    <p>First off, there are a few things about OOP that many people don't like, which makes them
    interested in learning and using other approaches. Below are some references from the OOP wiki
    article:</p>

    <ol>
      <li>Cardelli, Luca (1996). "Bad Engineering Properties of Object-Oriented Languages". ACM
      Comput. Surv. (ACM) 28 (4es): 150. doi:10.1145/242224.242415. ISSN 0360-0300. Retrieved 21
      April 2010.</li>

      <li>Armstrong, Joe. In Coders at Work: Reflections on the Craft of Programming. Peter Seibel,
      ed. <a target="_blank" href="http://codersatwork.com/">Codersatwork.com</a> , Accessed 13
      November 2009.</li>

      <li>Stepanov, Alexander. "STLport: An Interview with A. Stepanov". Retrieved 21 April
      2010.</li>

      <li>Rich Hickey, JVM Languages Summit 2009 keynote, Are We There Yet? November 2009.
      (edited)</li>
    </ol>taken from:

    <p><a target="_blank" href=
    "http://en.wikipedia.org/wiki/Object-oriented_programming#Criticism">Object-oriented
    programming</a></p>

    <p>Also see this post and discussion on hackernews:</p>

    <p><a target="_blank" href="https://news.ycombinator.com/item?id=8420060">Object Oriented
    Programming is an expensive disaster which must end</a></p>

    <p>One of the comments therein linked a few other good wikipedia articles which also provide
    relevant discussion on increasingly-popular alternatives to OOP:</p>

    <blockquote>
      <ol>
        <li>Modularity and design-by-contract are better implemented by module systems ( <a target=
        "_blank" href="http://en.wikipedia.org/wiki/Standard_ML#Module_system">Standard ML</a>
        )</li>

        <li>Encapsulation is better served by lexical scope ( <a target="_blank" href=
        "http://en.wikipedia.org/wiki/Scope_(computer_science)#Lexica...">http://en.wikipedia.org/wiki/Sco...</a>
        )</li>

        <li>Data is better modelled by algebraic datatypes ( <a target="_blank" href=
        "http://en.wikipedia.org/wiki/Algebraic_data_type">Algebraic data type</a> )</li>

        <li>Type-checking is better performed structurally ( <a target="_blank" href=
        "http://en.wikipedia.org/wiki/Structural_type_system">Structural type system</a> )</li>

        <li>Polymorphism is better handled by first-class functions ( <a target="_blank" href=
        "http://en.wikipedia.org/wiki/First-class_function">First-class function</a> ) and
        parametricity ( <a target="_blank" href=
        "http://en.wikipedia.org/wiki/Parametric_polymorphism">Parametric polymorphism</a> )</li>
      </ol>
    </blockquote><br>
    Personally, I sometimes think that OOP is a bit like an antique car. Sure, it has a bigger
    engine and fins and lots of chrome etc., it's fun to drive around, and it does look pretty. It
    is good for some applications, all kidding aside. The real question is not whether it's useful
    or not, but for how many projects?

    <p>When I'm done building an OOP application, it's like a large and elaborate structure.
    Changing the way objects are connected and organized can be hard, and the design choices of the
    past tend to become "frozen" or locked in place for all future times. Is this the best choice
    for every application? Probably not.</p>

    <p>If you want to drive 500-5000 miles a week in a car that you can fix yourself without
    special ordering any parts, it's probably better to go with a Honda or something more easily
    adaptable than an antique vehicle-with-fins.</p>

    <p>Finally, the best example is the growth of JavaScript as a language (officially called
    EcmaScript now?). Although JavaScript/EcmaScript (JS/ES) is not a pure functional programming
    language, it is much more "functional" than "OOP" in its design. JS/ES was the first mainstream
    language to promote the use of functional programming concepts such as higher-order functions,
    currying, and monads.</p>

    <p>The recent growth of the JS/ES open-source community has not only been impressive in its
    extent but also unexpected from the standpoint of many established programmers. This is partly
    evidenced by the overwhelming number of active repositories on Github using
    JavaScript/EcmaScript:</p>

    <p><a target="_blank" href="http://adambard.com/blog/top-github-languages-2014/">Top Github
    Languages of 2014 (So far)</a></p>

    <p>Because JS/ES treats both functions and objects as structs/hashes, it encourages us to blur
    the line dividing them in our minds. This is a division that many other languages impose -
    "there are functions and there are objects/variables, and they are different".</p>

    <p>This seemingly minor (and often confusing) design choice enables a lot of flexibility and
    power. In part this seemingly tiny detail has enabled JS/ES to achieve its meteoric growth
    between 2005-2015.</p>

    <p>This partially explains the rise of JS/ES and the corresponding relative decline of OOP. OOP
    had become a "standard" or "fixed" way of doing things for a while, and there will probably
    always be a time and place for OOP. But as programmers we should avoid getting too stuck in one
    way of thinking / doing things, because different applications may require different
    approaches.</p>

    <p>Above and beyond the OOP-vs-non-OOP debate, one of our main goals as engineers should be
    custom-tailoring our designs by skillfully choosing the most appropriate programming
    paradigm(s) for each distinct type of application, in order to maximize the "bang for the buck"
    that our software provides.</p>

    <p>Although this is something most engineers can agree on, we still have a long way to go until
    we reach some sort of consensus about how best to teach and hone these skills. This is not only
    a challenge for us as programmers today, but also a huge opportunity for the next generation of
    educators to create better guidelines and best practices than the current OOP-centric
    pedagogical system.</p>

    <p>Here are a couple of good books that elaborates on these ideas and techniques in more
    detail. They are free-to-read online:</p>

    <ol>
      <li><a target="_blank" href=
      "https://leanpub.com/javascriptallongesix/read">https://leanpub.com/javascriptal...</a></li>

      <li><a target="_blank" href=
      "https://leanpub.com/javascript-spessore/read">https://leanpub.com/javascript-s...</a></li>
    </ol><a target="_blank" href="https://www.quora.com/profile/Mike-MacHenry">Mike MacHenry</a> ,
    software engineer, improv comedian, maker <a target="_blank" href=
    "https://www.quora.com/Why-do-many-people-assume-OOP-is-on-the-decline/answer/Mike-MacHenry">Answered
    Feb 14, 2015</a> · Author has 286 answers and 513.7k answer views Because the phrase
    itself was over hyped to an extrodinary degree. Then as is common with over hyped things many
    other things took on that phrase as a name. Then people got confused and stopped calling what
    they are don't OOP.

    <p>Yes I think OOP ( the phrase ) is on the decline because people are becoming more educated
    about the topic.</p>

    <p>It's like, artificial intelligence, now that I think about it. There aren't many people
    these days that say they do AI to anyone but the laymen. They would say they do machine
    learning or natural language processing or something else. These are fields that the vastly
    over hyped and really nebulous term AI used to describe but then AI ( the term ) experienced a
    sharp decline while these very concrete fields continued to flourish.</p>
 <!--TAGS: . ~/Perl -->
 <!--file:///f:/Public_html/SE/anti_oo.shtml-->
<!--file:///f:/Public_html/SE/programming_style.shtml-->
<!--file:///f:/Public_html/SE/index.shtml-->
<!--file:///f:/Public_html/Lang/index.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191115X_why_do_many_people_assume_oop_is_on_the_decline"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191115X_why_is_perl_so_hated_and_still_commonly_used_and_why_should_i_learn_it" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191115X_why_are_unix_system_administrators_still_using_perl_for_scripting_when_they_could"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 15, 2019] <a target="_blank" href="https://www.quora.com/Why-is-Perl-so-hated-and-not-commonly-used-And-why-should-I-learn-it">Why   is Perl so hated and still commonly used? And why should I learn it?</a></h4>

<h5>Notable quotes:</h5>
<h5>"...  Per Damien Conway’s recommendations, I always         unpack all the arguments from @_in the first line of a subroutine, which ends up looking         just like a subroutine signature. (I almost never use shift for this purpose.) ..."</h5>
<h5>"...  Perl bashing is largely hear-say. People hear something and they say it. It doesn't       require a great deal of thought. ..."</h5>
<h5>"...  It may not be as common as the usual       gang of languages, but there's an enormous amount of work done in Perl. ..."</h5>
<blockquote>
<h6>Nov 05, 2017 |  <a target="_blank" href= "https://www.quora.com/Why-is-Perl-so-hated-and-not-commonly-used-And-why-should-I-learn-it">www.quora.com</a></h6>
 
    <hr noshade align="left" width="10" size="10">

    <p><a target="_blank" href="https://www.quora.com/profile/Joe-Zbiciak">Joe Zbiciak</a> ,
    Employed <a target="_blank" href=
    "https://www.quora.com/Why-is-Perl-so-hated-and-not-commonly-used-And-why-should-I-learn-it/answer/Joe-Zbiciak">
    Updated Nov 5 2017</a> · Author has 2k answers and 7.3m answer views</p>

    <blockquote>
      <p><i>Perl bashing is popular sport among a particularly vocal crowd.</i></p>

      <p>Perl is <i>extremely</i> flexible. Perl holds up <a target="_blank" href=
      "http://wiki.c2.com/?ThereIsMoreThanOneWayToDoIt">TIMTOWTDI</a> ( <i>There Is More Than One
      Way To Do It</i> ) as a virtue. Larry Wall's Twitter handle is <a target="_blank" href=
      "https://twitter.com/timtoady?lang=en">@TimToady,</a> for goodness sake!</p>

      <p>That flexibility makes it extremely powerful. It also makes it extremely easy to write
      code that nobody else can understand. <a target="_blank" href=
      "https://en.wikipedia.org/wiki/There's_more_than_one_way_to_do_it">(Hence, Tim Toady
      Bicarbonate.)</a></p>

      <p>You can pack a lot of punch in a one-liner in Perl:</p>

      <ol>
        <li><tt>print $fo map { sprintf ( " .pword 0x%.6X\n" , $_ ) } unpack ( "n*" , $data
        );</tt></li>
      </ol>

      <p>That one-liner takes a block of raw data (in <code style="">$data</code> ), expands it to
      an array of values, and th...</p>
    </blockquote><a target="_blank" href="https://www.quora.com/profile/Joachim-Pense">Joachim
    Pense</a> , Perl is my language of choice <a target="_blank" href=
    "https://www.quora.com/Why-is-Perl-so-hated-and-not-commonly-used-And-why-should-I-learn-it/answer/Joachim-Pense">
    Answered Nov 4, 2017</a> · Author has 6.1k answers and 7.1m answer views

    <blockquote>
      <p>It is still used, but its usage is declining. People use Python today in situations when
      they would have used Perl ten years ago.</p>

      <p>The problem is that Perl is extremely pragmatic. It is designed to be “a language to
      get your job done”, and it does that well; however, that led to rejection by language
      formalists. However, Perl is very well designed, only it is well designed for professionals
      who grab in the dark expecting that at this place there should be a button to do the desired
      functionality, and indeed, there will be the button. It is much safer to use than for example
      C (the sharp knife that was delivered without a handle), but it is easy to produce quite
      messy code with it if you are a newbie who doesn’t understand/feel the principles of
      Perl. In the 90s and 2000s, it was the goto web language, so the web was full of terrible
      programs written by those newbies, and that led to the bad reputation.</p>

      <p>Strangely enough, PHP, which is frowned upon a lot by Perl programmers, won the favour of
      the noobs, but never got the general bad reputation; in fact it is missing the design
      principles I mentioned, that language is just a product of adhockery.</p>

      <p>But today, Perl went back to its status as a niche language, and you cannot mention it in
      presence of a lady, so to speak. Its support is slowly waning; I’d suggest to learn
      Python, but don’t force me to learn it as well.</p>
    </blockquote>

    <p><a target="_blank" href="https://www.quora.com/profile/John-Robinson-759">John Robinson</a>
    , Software Engineer <a target="_blank" href=
    "https://www.quora.com/Why-is-Perl-so-hated-and-not-commonly-used-And-why-should-I-learn-it/answer/John-Robinson-759">
    Answered Nov 4, 2017</a> · Author has 416 answers and 92.9k answer views</p>

    <blockquote>
      <p>You should learn things that make your life easier or better. I am not an excellent Perl
      user, but it is usually my go-to scripting language for important projects. The syntax is
      difficult, and it's very easy to forget how to use it when you take significant time away
      from it.</p>

      <p>That being said, I love how regular expressions work in Perl. I can use sed like commands
      $myvar =~ s/old/new/g for string replacement when processing or filtering strings. It's much
      nicer than other languages imo.</p>

      <p>I also like Perls foreach loops and its data structures.</p>

      <p>I tried writing a program of moderate length in Python and it just seemed to be taking up
      too much space. I stopped part way though and switched to Perl. I got the whole thing
      completed in much less space (lines), and seemed to have an easier time doing it.</p>

      <p>I am not a super fanboy, but it has just always worked for me in the past, and I can't
      outright discount it because of that.</p>

      <p>Also, look up CPAN modules. The installation of those for me on GNU is a breeze.</p>

      <p>My last scripting project I did in Python and it went very well. I will probably shift to
      Python more in the future, because I would like to build a stronger basis of knowledge with
      the modules and basics of Python so that I can hop into it and create some powerful stuff
      when needed. Ie I want to focus on 1–3 languages, and learn them to a higher level
      instead of being "just ok" with 5–7.</p>
    </blockquote><a target="_blank" href="https://www.quora.com/profile/Gary-Puckering">Gary
    Puckering</a> , Fluent in C#, Python, and perl; rusty in C/C++ and too many others to count
    <a target="_blank" href=
    "https://www.quora.com/Why-is-Perl-so-hated-and-not-commonly-used-And-why-should-I-learn-it/answer/Gary-Puckering">
    Answered Apr 25, 2018</a> · Author has 1.1k answers and 2.5m answer views

    <blockquote>
      <p><b>Why is Perl so hated and not commonly used?</b></p>

      <p>I think there are several reasons why Perl has a lot of detractors</p>

      <ol>
        <li><b>Sigils</b> . A lot of programmers seem to hate the $@% sigils! If you are coming
        from a strongly typed language like C/C++, and also hate things like Hungarian notation,
        you won’t like sigils.</li>

        <li><b>One liners.</b> As others have commented, writing dense and even obfuscated code
        rose to the level of sport within the Perl community. The same thing happened, years
        earlier, in the APL community. Programmers and managers saw that you could write
        unmaintainable code, and that helped instill a fear that it was unavoidable and that
        perhaps the language was flawed because it didn’t discourage the practice.</li>

        <li><b>Auto-magic</b> . The programming language PL/I, which attempted to combine the best
        of COBOL and FORTRAN, went absolutely crazy with default behaviors. I remember reading an
        article in the 1970’s where programming in PL/I was described as being like flying a
        Boeing 747. The cockpit is filled with hundreds of buttons, knobs, switches and levers. The
        autopilot does most of the work, but trying to figure out the interaction between it and
        things you manually set can be bewildering. Perl, to some extent, suffers from the same
        problem. In Perl 5, without enabling warnings and strict, variables spring into life simply
        by naming them. A typo can instantiate and entirely new variable. Hashes get new keys
        simply by an attempt to access a key. You can increment a scalar that contains a string and
        it’ll try to generate a sequence using the string as a pattern (e.g. a, b, c …
        z, aa, ab …). If you come from a language where you control everything, all this
        auto-magic stuff can really bite you in the ass.</li>

        <li><b>An odd object-oriented syntax.</b> Until Moose (and now Moo and Mouse) came along,
        writing classes in Perl meant using keywords like package and bless, as well as rolling all
        your own accessor methods. If you come from C++, Java <b>,</b> Python or just about any
        other language supporting OO your first question is going to be: where’s the
        friggin’ <b>class</b> statement!</li>

        <li><b>Dynamic typing</b> . Some people like it. Some hate it. There are modules that let
        you add typing I’d you wish, though it’ll only be enforced at run time.</li>

        <li><b>No subroutine signatures</b> . Although Perl 5 now supports subroutine signatures,
        they are still considered “experimental”. This is a turn-off for most
        programmers who are used to them. <em>Per Damien Conway’s recommendations, I always
        unpack all the arguments from @_in the first line of a subroutine, which ends up looking
        just like a subroutine signature. (I almost never use shift for this purpose.)</em></li>

        <li><b>Lots of magic symbols</b> . Although you can use English names, and should do so for
        more maintainable code, many Perl programmers stick to using special names like $_,
        $’, $; etc. This makes Perl code look very cryptic, and increases your cognitive load
        when working with the language. It’s a lot to remember. But if you use the English
        names, you can largely avoid this issue.</li>

        <li><b>Perl 6 is a discontinuous evolution</b> . Although Perl 5 continues to evolve, and
        some of the advances that have been put in Perl 6 have been added to Perl 5, the lack
        of,upward compatibility between 5 and 6 creates uncertainly about its future.</li>
      </ol>

      <p><b>And why should I learn it?</b></p>

      <p>Despite the above, you can write maintainable code in Perl by following Damian
      Comways’s Perl Best Practices. The utility <b>perlcritic</b> can be used to help train
      yourself to write better Perl code.</p>

      <p>Perl is multi-paradigm. In execution, it’s faster than Python. It has a superb
      ecosystem in <b>cpan</b> , where you can find a module to help you solve almost every
      imaginable problem. For command line utilities, file system administration, database
      administration, data extraction-transformation-loading tasks, batch processes, connecting
      disparate systems, and quick and dirty scripts, it’s often the best tool for the
      job.</p>

      <p>I frequently use Perl in connection with Excel. You can do a lot in Excel, and it provides
      a great interactive UI. But complex formulas can be a pain to get right, and it can be
      tedious to write code in VBA. Often, I find it much quicker to just copy cells to the
      clipboard, switch to a command shell, run a Perl script over the data, sending the results to
      the clipboard, switch back to Excel, and then paste the results in situ or in a new
      location.</p>

      <p>Perl is also deep. It does a good job of supporting imperative programming, OOP, and
      functional programming. For more on the latter, see the book <a target="_blank" href=
      "https://hop.perl.plover.com/">Higher-Order Perl</a> .</p>

      <p>Perl is powerful. Perl is fast. Perl is an effective tool to have in your toolkit. Those
      are all good reasons to learn it.</p>
    </blockquote>

    <p><a target="_blank" href="https://www.quora.com/profile/Reed-White">Reed White</a> , former
    Engineer at Hewlett-Packard (1978-2000) <a target="_blank" href=
    "https://www.quora.com/Why-is-Perl-so-hated-and-not-commonly-used-And-why-should-I-learn-it/answer/Reed-White">
    Answered Nov 7, 2017</a> · Author has 2.3k answers and 380.8k answer views</p>

    <blockquote>
      <p>Yes, Perl takes verbal abuse; but in truth, it is an extremely powerful, reliable
      language. In my opinion, one of its outstanding characteristics is that you don't need much
      knowledge before you can write useful programs. As time goes by, you gradually learn the real
      power of the language.</p>

      <p>However, because Perl-bashing is popular, you might better put your efforts into learning
      Python, which is also quite capable.</p>
    </blockquote>

    <p><a target="_blank" href="https://www.quora.com/profile/Richard-Conto">Richard Conto</a> ,
    Programmer in multiple languages. Debugger in even more <a target="_blank" href=
    "https://www.quora.com/Why-is-Perl-so-hated-and-not-commonly-used-And-why-should-I-learn-it/answer/Richard-Conto">
    Answered Dec 18, 2017</a> · Author has 5.9k answers and 4.3m answer views</p>

    <blockquote>
      <p><em>Perl bashing is largely hear-say. People hear something and they say it. It doesn't
      require a great deal of thought.</em></p>

      <p>As for Perl not commonly being used - that's BS. <em>It may not be as common as the usual
      gang of languages, but there's an enormous amount of work done in Perl.</em></p>

      <p>As for you you should learn Perl, it's for the same reason you would learn any other
      language - it helps you solve a particular problem better than another language available.
      And yes, that can be a very subjective decision to make.</p>
    </blockquote>

    <p><a target="_blank" href="https://www.quora.com/profile/Randal-L-Schwartz">Randal L.
    Schwartz</a> , Literally "wrote the books" on it <a target="_blank" href=
    "https://www.quora.com/Why-is-Perl-so-hated-and-not-commonly-used-And-why-should-I-learn-it/answer/Randal-L-Schwartz">
    Answered Mar 3, 2018</a> · Author has 108 answers and 90.5k answer views</p>

    <blockquote>
      <p>The truth is, that by any metric, more Perl is being done today than during the dot com
      boom. It's just a somewhat smaller piece of a much bigger pie. In fact, I've heard from some
      hiring managers that there's actually a <b>shortage</b> of Perl programmers, and not just for
      maintaining projects, but for new greenfield deploys.</p>
    </blockquote>
 <!--TAGS: . ~/Perl -->
 <!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191115X_why_is_perl_so_hated_and_still_commonly_used_and_why_should_i_learn_it"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191115X_why_are_unix_system_administrators_still_using_perl_for_scripting_when_they_could" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191114X_perl_package_variable_scope_in_module_subroutine_stack_overflow"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 15, 2019] <a target="_blank" href="https://www.quora.com/Why-are-Unix-system-administrators-still-using-Perl-for-scripting-when-they-could-use-Python">   Why are Unix system administrators still using Perl for scripting when they could use Python -   Quora</a></h4>

<blockquote>
<h6>Nov 15, 2019 |  <a target="_blank" href= "https://www.quora.com/Why-are-Unix-system-administrators-still-using-Perl-for-scripting-when-they-could-use-Python"> www.quora.com</a></h6>
 

    <p><b>Why are Unix system administrators still using Perl for scripting when they could use
    Python?</b> <a>Update Cancel</a></p>

    <p>a OYLu d zEv ORPC b dRl y q nyXNY D AZ a eSr t gpl a yTipB d lH o xE g ookz H Tr Q voRm .
    iKPKM c YuOhH o M m HVViy <a target="_blank" href=
    "https://www.datadoghq.com/dg/monitor/docker-benefits/">Visualize Docker performance and usage
    in real time. Track Docker health and usage alongside custom metrics from your apps and
    services. Try Datadog for free. Learn More</a> You dismissed this ad. The feedback you provide
    will help us show you more relevant content in the future. <a>Undo</a> <b>Answer Wiki</b> 12
    Answers <a target="_blank" href="https://www.quora.com/profile/Joshua-Day-34"><img alt=
    "Joshua Day" src=
    "https://qph.fs.quoracdn.net/main-thumb-431626752-100-dovjipvsjaqjuyupgqnzniqwhyahbtav.jpeg"></a></p>

    <p><a target="_blank" href="https://www.quora.com/profile/Joshua-Day-34">Joshua Day</a> ,
    Currently developing reporting and testing tools for linux <a target="_blank" href=
    "https://www.quora.com/Why-are-Unix-system-administrators-still-using-Perl-for-scripting-when-they-could-use-Python/answer/Joshua-Day-34">
    Updated Apr 26</a> · Author has 83 answers and 71k answer views</p>

    <p>There are several reasons and ill try to name a few.</p>

    <ol>
      <li>Perl syntax and semantics closely resembles shell languages that are part of core Unix
      systems like sed, awk, and bash. Of these languages at least bash knowledge is required to
      administer a Unix system anyway.</li>

      <li>Perl was designed to replace or improve the shell languages in Unix/linux by combining
      all their best features into a single language whereby an administrator can write a complex
      script with a single language instead of 3 languages. It was essentially designed for
      Unix/linux system administration.</li>

      <li>Perl regular expressions (text manipulation) were modeled off of sed and then drastically
      improved upon to the extent that subsequent languages like python have borrowed the syntax
      because of just how powerful it is. This is infinitely powerful on a unix system because the
      entire OS is controlled using textual data and files. No other language ever devised has
      implemented regular expressions as gracefully as perl and that includes the beloved python.
      Only in perl is regex integrated with such natural syntax.</li>

      <li>Perl typically comes preinstalled on Unix and linux systems and is practically considered
      part of the collection of softwares that define such a system.</li>

      <li>Thousands of apps written for Unix and linux utilize the unique properties of this
      language to accomplish any number of tasks. A Unix/linux sysadmin must be somewhat familiar
      with perl to be effective at all. To remove the language would take considerable effort for
      most systems to the extent that it's not practical.. Therefore with regard to this
      environment Perl will remain for years to come.</li>

      <li>Perl's module archive called CPAN already contains a massive quantity of modules geared
      directly for unix systems. If you use Perl for your administration tasks you can capitalize
      on these modules. These are not newly written and untested modules. These libraries have been
      controlling Unix systems for 20 years reliably and the pinnacle of stability in Unix systems
      running across the world.</li>

      <li>Perl is particularly good at glueing other software together. It can take the output of
      one application and manipulate it into a format that is easily consumable by another, mostly
      due to its simplistic text manipulation syntax. This has made Perl the number 1 glue language
      in the world. There are millions of softwares around the world that are talking to each other
      even though they were not designed to do so. This is in large part because of Perl. This
      particular niche will probably decline as standardization of interchange formats and APIs
      improves but it will never go away.</li>
    </ol>

    <p>I hope this helps you understand why perl is so prominent for Unix administrators. These
    features may not seem so obviously valuable on windows systems and the like. However on Unix
    systems this language comes alive like no other.</p>
 <!--TAGS: . ~/Perl -->
 <!--file:///f:/Public_html/Scripting/index.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191115X_why_are_unix_system_administrators_still_using_perl_for_scripting_when_they_could"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191114X_perl_package_variable_scope_in_module_subroutine_stack_overflow" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191113X_how_fast_is_perl_s_smartmatch_operator_when_searching_for_a_scalar_in_an_array"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 14, 2019] <a target="_blank" href="https://stackoverflow.com/questions/9976813/package-variable-scope-in-module-subroutine">perl -   package variable scope in module subroutine - Stack Overflow</a></h4>

<blockquote>
<h6>Nov 14, 2019 |  <a target="_blank" href= "https://stackoverflow.com/questions/9976813/package-variable-scope-in-module-subroutine">stackoverflow.com</a></h6>
 
 

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/questions/9976813/package-variable-scope-in-module-subroutine">package
    variable scope in module subroutine</a></b> <a target="_blank" href=
    "https://stackoverflow.com/questions/ask">Ask Question</a> Asked 7 years, 7 months ago Active
    <a target="_blank" href=
    "https://stackoverflow.com/questions/9976813/package-variable-scope-in-module-subroutine?lastactivity">
    7 years, 7 months ago</a> Viewed 20k times 8 1</p>
    <hr noshade align="left" width="10" size="10">

    <p><b><a target="_blank" href="https://stackoverflow.com/users/2766176/brian-d-foy">brian d
    foy</a></b> ,Jul 17, 2014 at 17:54</p>

    <blockquote>
      How do I change the value of a variable in the package used by a module so that subroutines
      in that module can use it?

      <p>Here's my test case:</p>

      <p>testmodule.pm:</p>
      <pre>
package testmodule;

use strict;
use warnings;
require Exporter;

our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);

@ISA = qw(Exporter);
@EXPORT = qw(testsub);

my $greeting = "hello testmodule";
my $var2;

sub testsub {
    printf "__PACKAGE__: %s\n", __PACKAGE__;
    printf "\$main::greeting: %s\n", $main::greeting;
    printf "\$greeting: %s\n", $greeting;
    printf "\$testmodule::greeting: %s\n", $testmodule::greeting;
    printf "\$var2: %s\n", $var2;
} # End testsub
1;
</pre>

      <p>testscript.pl:</p>
      <pre>
#!/usr/bin/perl -w
use strict;
use warnings;
use testmodule;

our $greeting = "hello main";
my $var2 = "my var2 in testscript";

$testmodule::greeting = "hello testmodule from testscript";
$testmodule::var2 = "hello var2 from testscript";

testsub();
</pre>

      <p>output:</p>
      <pre>
Name "testmodule::var2" used only once: possible typo at ./testscript.pl line 11.
__PACKAGE__: testmodule
$main::greeting: hello main
$greeting: hello testmodule
$testmodule::greeting: hello testmodule from testscript
Use of uninitialized value $var2 in printf at testmodule.pm line 20.
$var2:
</pre>

      <p>I expected <code>$greeting</code> and <code>$testmodule::greeting</code> to be the same
      since the package of the subroutine is <code>testmodule</code> .</p>

      <p>I guess this has something to do with the way <code>use</code> d modules are
      <code>eval</code> d as if in a <code>BEGIN</code> block, but I'd like to understand it
      better.</p>

      <p>I was hoping to set the value of the variable from the main script and use it in the
      module's subroutine without using the fully-qualified name of the variable.</p>
    </blockquote>

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/users/1617711/perl-user">perl-user</a></b> ,Sep 5, 2013 at 13:58</p>

    <blockquote>
      As you found out, when you use <code>my</code> , you are creating a locally scoped
      non-package variable. To create a package variable, you use <code>our</code> and not
      <code>my</code> :
      <pre>
my $foo = "this is a locally scoped, non-package variable";
our $bar = "This is a package variable that's visible in the entire package";
</pre>

      <p>Even better:</p>
      <pre>
{
   my $foo = "This variable is only available in this block";
   our $bar = "This variable is available in the whole package":
}

print "$foo\n";    #Whoops! Undefined variable
print "$bar\n";    #Bar is still defined even out of the block
</pre>

      <p>When you don't put <code>use strict</code> in your program, all variables defined are
      package variables. That's why when you don't put it, it works the way you think it should and
      putting it in <i>breaks</i> your program.</p>

      <p>However, as you can see in the following example, using <code>our</code> will solve your
      dilemma:</p><b>File <code>Local/Foo.pm</code></b>
      <pre>
#! /usr/local/bin perl
package Local::Foo;

use strict;
use warnings;
use feature qw(say);

use Exporter 'import';
our @EXPORT = qw(testme);

our $bar = "This is the package's bar value!";
sub testme {

    # $foo is a locally scoped, non-package variable. It's undefined and an error
    say qq(The value of \$main::foo is "$main::foo");

    # $bar is defined in package main::, and will print out
    say qq(The value of \$main::bar is "$main::bar");

    # These both refer to $Local::Foo::bar
    say qq(The value of \$Local::Foo::bar is "$Local::Foo::bar");
    say qq(The value of bar is "$bar");
}

1;
</pre><b>File <code>test.pl</code></b>
      <pre>
#! /usr/local/bin perl
use strict;
use warnings;
use feature qw(say);
use Local::Foo;

my $foo = "This is foo";
our $bar = "This is bar";
testme;

say "";
$Local::Foo::bar = "This is the NEW value for the package's bar";
testme
</pre>

      <p>And, the output is:</p>
      <pre>
Use of uninitialized value $foo in concatenation (.) or string at Local/Foo.pm line 14.
The value of $main::foo is ""
The value of $main::bar is "This is bar"
The value of $Local::Foo::bar is "This is the package's bar value!"
The value of bar is "This is the package's bar value!"

Use of uninitialized value $foo in concatenation (.) or string at Local/Foo.pm line 14.
The value of $main::foo is ""
The value of $main::bar is "This is bar"
The value of $Local::Foo::bar is "This is the NEW value for the package's bar"
The value of bar is "This is the NEW value for the package's bar"
</pre>

      <p>The error message you're getting is the result of <code>$foo</code> being a local
      variable, and thus isn't visible inside the package. Meanwhile, <code>$bar</code> is a
      package variable and is visible.</p>

      <p>Sometimes, it can be a bit tricky:</p>
      <pre>
if ($bar -eq "one") {
   my $foo = 1;
}
else {
   my $foo = 2;
}

print "Foo = $foo\n";
</pre>

      <p>That doesn't work because <code>$foo</code> only bas a value inside the <code>if</code>
      block. You have to do this:</p>
      <pre>
my $foo;
if ($bar -eq "one") {
   $foo = 1;
}
else {
  $foo = 2;
}

print "Foo = $foo\n"; #This works!
</pre>

      <p>Yes, it can be a bit to get your head wrapped around it initially, but the use of
      <code>use strict;</code> and <code>use warnings;</code> is now de rigueur and for good
      reasons. The use of <code>use strict;</code> and <code>use warnings;</code> probably has
      eliminated 90% of the mistakes people make in Perl. You can't make a mistake of setting the
      value of <code>$foo</code> in one part of the program, and attempting to use
      <code>$Foo</code> in another. It's one of the things I really miss in Python.</p>
    </blockquote>

    <p><b>></b> ,</p>

    <blockquote>
      After reading <a target="_blank" href="http://www.perlmonks.org/?node_id=66677">Variable
      Scoping in Perl: the basics</a> more carefully, I realized that a variable declared with
      <code>my</code> isn't in the current package. For example, in a simple script with no modules
      if I declare <code>my $var = "hello"</code> <code>$main::var</code> still doesn't have a
      value.

      <p>The way that this applies in this case is in the module. Since <code>my $greeting</code>
      is declared in the file, that hides the package's version of <code>$greeting</code> and
      that's the value which the subroutine sees. If I don't declare the variable first, the
      subroutine would see the package variable, but it doesn't get that far because I <code>use
      strict</code> .</p>

      <p>If I don't <code>use strict</code> and don't declare <code>my $greeting</code> , it works
      as I would have expected. Another way to get the intended value and not break <code>use
      strict</code> is to use <code>our $greeting</code> . The difference being that <a target=
      "_blank" href="http://perldoc.perl.org/functions/my.html">my</a> declares a variable in the
      current <i>scope</i> while <a target="_blank" href=
      "http://perldoc.perl.org/functions/our.html">our</a> declares a variable in the current
      <i>package</i> .</p>
    </blockquote>
 <!--TAGS: . ~/Scripting -->

<!--file:///f:/Public_html/Scripting/Perlorama/Variables/our_variables.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/Variables/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>


</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191114X_perl_package_variable_scope_in_module_subroutine_stack_overflow"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191113X_how_fast_is_perl_s_smartmatch_operator_when_searching_for_a_scalar_in_an_array" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191113X_static_code_analysis_module_in_perl_stack_overflow"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 13, 2019] <a target="_blank" href="https://stackoverflow.com/questions/3951812/how-fast-is-perls-smartmatch-operator-when-searching-for-a-scalar-in-an-array"> How fast is Perl s smartmatch operator when searching for a scalar in an array</a></h4>

<blockquote>
<h6>Nov 13, 2019 |  <a target="_blank" href="https://stackoverflow.com/questions/3951812/how-fast-is-perls-smartmatch-operator-when-searching-for-a-scalar-in-an-array"> stackoverflow.com</a></h6>
 
 
   <hr noshade align="left" width="10" size="10">

   <p><b><a target="_blank" href="https://stackoverflow.com/users/3333/paul-tomblin">Paul Tomblin</a></b> ,Oct 19, 2010 at 13:38</p>
   <blockquote>
      I want to repeatedly search for values in an array that does not change.

      <p>So far, I have been doing it this way: I put the values in a hash (so I have an array and a hash with essentially the same 
      contents) and I search the hash using <code>exists</code> .</p>

      <p>I don't like having two different variables (the array and the hash) that both store the same thing; however, the hash is much 
      faster for searching.</p>

      <p>I found out that there is a <code>~~</code> (smartmatch) operator in Perl 5.10. How efficient is it when searching for a scalar 
      in an array?</p>
   </blockquote>

   <p><b>></b> ,</p>
   <blockquote>
      If you want to search for a single scalar in an array, you can use
      <a target="_blank" href="http://search.cpan.org/dist/List-Util">List::Util</a> 's <code>first</code> subroutine. It stops as soon 
      as it knows the answer. I don't expect this to be faster than a hash lookup <i>if you already have the hash</i> , but when you 
      consider creating the hash and having it in memory, it might be more convenient for you to just search the array you already have.

      <p>As for the smarts of the smart-match operator, if you want to see how smart it is, test it. :)</p>

      <p>There are at least three cases you want to examine. The worst case is that every element you want to find is at the end. The 
      best case is that every element you want to find is at the beginning. The likely case is that the elements you want to find average 
      out to being in the middle.</p>

      <p>Now, before I start this benchmark, I expect that if the smart match can short circuit (and it can; its documented in
      <a target="_blank" href="http://perldoc.perl.org/perlsyn.html">perlsyn</a> ), that the best case times will stay the same despite 
      the array size, while the other ones get increasingly worse. If it can't short circuit and has to scan the entire array every 
      time, there should be no difference in the times because every case involves the same amount of work.</p>

      <p>Here's a benchmark:</p>

      <pre>
#!perl
use 5.12.2;
use strict;
use warnings;

use Benchmark qw(cmpthese);

my @hits = qw(A B C);
my @base = qw(one two three four five six) x ( $ARGV[0] || 1 );

my @at_end       = ( @base, @hits );
my @at_beginning = ( @hits, @base );

my @in_middle = @base;
splice @in_middle, int( @in_middle / 2 ), 0, @hits;

my @random = @base;
foreach my $item ( @hits ) {
    my $index = int rand @random;
    splice @random, $index, 0, $item;
    }

sub count {
    my( $hits, $candidates ) = @_;

    my $count;
    foreach ( @$hits ) { when( $candidates ) { $count++ } }
    $count;
    }

cmpthese(-5, {
    hits_beginning => sub { my $count = count( \@hits, \@at_beginning ) },
    hits_end       => sub { my $count = count( \@hits, \@at_end ) },
    hits_middle    => sub { my $count = count( \@hits, \@in_middle ) },
    hits_random    => sub { my $count = count( \@hits, \@random ) },
    control        => sub { my $count = count( [], [] ) },
  }
);
</pre>
      div class="answercell post-layout--right
   </blockquote>

   <p>,</p>
   <blockquote>
      Here's how the various parts did. Note that this is a logarithmic plot on both axes, so the slopes of the plunging lines aren't 
      as close as they look:

      <p>So, it looks like the smart match operator is a bit smart, but that doesn't really help you because you still might have to 
      scan the entire array. You probably don't know ahead of time where you'll find your elements. I expect a hash will perform the 
      same as the best case smart match, even if you have to give up some memory for it.</p>
      <hr>

      <p>Okay, so the smart match being smart times two is great, but the real question is "Should I use it?". The alternative is a 
      hash lookup, and it's been bugging me that I haven't considered that case.</p>

      <p>As with any benchmark, I start off thinking about what the results might be before I actually test them. I expect that if I 
      already have the hash, looking up a value is going to be lightning fast. That case isn't a problem. I'm more interested in the 
      case where I don't have the hash yet. How quickly can I make the hash and lookup a key? I expect that to perform not so well, 
      but is it still better than the worst case smart match?</p>

      <p>Before you see the benchmark, though, remember that there's almost never enough information about which technique you should 
      use just by looking at the numbers. The context of the problem selects the best technique, not the fastest, contextless micro-benchmark. 
      Consider a couple of cases that would select different techniques:</p>
      <ul>

         <li>You have one array you will search repeatedly</li>

         <li>You always get a new array that you only need to search once</li>

         <li>You get very large arrays but have limited memory</li>
      </ul>

      <p>Now, keeping those in mind, I add to my previous program:</p>

      <pre>
my %old_hash = map {$_,1} @in_middle; 

cmpthese(-5, {
    ...,
    new_hash       => sub { 
        my %h = map {$_,1} @in_middle; 
        my $count = 0;
        foreach ( @hits ) { $count++ if exists $h{$_} }
        $count;
        },
    old_hash       => sub { 
        my $count = 0;
        foreach ( @hits ) { $count++ if exists $old_hash{$_} }
        $count;
        },
    control_hash   => sub { 
        my $count = 0;
        foreach ( @hits ) { $count++ }
        $count;
        },
    }
);
</pre>

      <p>Here's the plot. The colors are a bit difficult to distinguish. The lowest line there is the case where you have to create 
      the hash any time you want to search it. That's pretty poor. The highest two (green) lines are the control for the hash (no hash 
      actually there) and the existing hash lookup. This is a log/log plot; those two cases are faster than even the smart match control 
      (which just calls a subroutine).</p>

      <p>There are a few other things to note. The lines for the "random" case are a bit different. That's understandable because each 
      benchmark (so, once per array scale run) randomly places the hit elements in the candidate array. Some runs put them a bit earlier 
      and some a bit later, but since I only make the <code>@random</code> array once per run of the entire program, they move around 
      a bit. That means that the bumps in the line aren't significant. If I tried all positions and averaged, I expect that "random" 
      line to be the same as the "middle" line.</p>

      <p>Now, looking at these results, I'd say that a smart-match is much faster in its worst case than the hash lookup is in its worst 
      case. That makes sense. To create a hash, I have to visit every element of the array and also make the hash, which is a lot of 
      copying. There's no copying with the smart match.</p>

      <p>Here's a further case I won't examine though. When does the hash become better than the smart match? That is, when does the 
      overhead of creating the hash spread out enough over repeated searches that the hash is the better choice?</p>
   </blockquote>

   <p>,</p>
   <blockquote>
      Fast for small numbers of potential matches, but not faster than the hash. Hashes are really the right tool for testing set membership. 
      Since hash access is O(log n) and smartmatch on an array is still O(n) linear scan (albeit short-circuiting, unlike grep), with 
      larger numbers of values in the allowed matches, smartmatch gets relatively worse. <b>Benchmark code (matching against 3 values):</b>

      <pre>
#!perl
use 5.12.0;
use Benchmark qw(cmpthese);

my @hits = qw(one two three);
my @candidates = qw(one two three four five six); # 50% hit rate
my %hash;
@hash{@hits} = ();

sub count_hits_hash {
  my $count = 0;
  for (@_) {
    $count++ if exists $hash{$_};
  }
  $count;
}

sub count_hits_smartmatch {
  my $count = 0;
  for (@_) {
    $count++ when @hits;
  }
  $count;
}

say count_hits_hash(@candidates);
say count_hits_smartmatch(@candidates);

cmpthese(-5, {
    hash => sub { count_hits_hash((@candidates) x 1000) },
    smartmatch => sub { count_hits_smartmatch((@candidates) x 1000) },
  }
);
</pre>
      <b>Benchmark results:</b>

      <pre>
             Rate smartmatch       hash
smartmatch  404/s         --       -65%
hash       1144/s       183%         --
</pre>
   </blockquote>
    <ul>
   </ul>
<!--TAGS: . ~/Scripting -->

<!--file:///f:/Public_html/Scripting/Perlorama/Variables/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>



</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191113X_how_fast_is_perl_s_smartmatch_operator_when_searching_for_a_scalar_in_an_array"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191113X_static_code_analysis_module_in_perl_stack_overflow" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191112X_lib_module_checkstyle_pm"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 13, 2019] <a target="_blank" href="https://stackoverflow.com/questions/10991702/static-code-analysis-module-in-perl">Static code   analysis module in Perl - Stack Overflow</a></h4>

<blockquote>
<h6>Nov 13, 2019 |  <a target="_blank" href= "https://stackoverflow.com/questions/10991702/static-code-analysis-module-in-perl">stackoverflow.com</a></h6>
 

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/questions/10991702/static-code-analysis-module-in-perl">Static code
    analysis module in Perl</a></b> <a target="_blank" href=
    "https://stackoverflow.com/questions/ask">Ask Question</a> Asked 7 years, 5 months ago Active
    <a target="_blank" href=
    "https://stackoverflow.com/questions/10991702/static-code-analysis-module-in-perl?lastactivity">
    1 year, 7 months ago</a> Viewed 835 times 0</p>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/716443/davido">DavidO</a></b>
    ,Jun 12, 2012 at 9:13</p>

    <blockquote>
      Is there any static code analysis module in Perl except B::Lint and Perl::Critic? How
      effective is Module::Checkstyle?
    </blockquote>

    <p><b>></b> ,</p>

    <blockquote>
      There is a <a target="_blank" href="http://www.perlmonks.org/?node_id=943316">post</a> on
      perlmonks.org asking if PPI can be used for static analysis. PPI is the power behind
      Perl::Critic, according to the <a target="_blank" href=
      "http://cpanratings.perl.org/dist/PPI">reviews</a> of this module. (I have not used it yet).

      <p>Then there is <a target="_blank" href="http://en.wikipedia.org/wiki/PerlTidy">perltidy</a>
      .</p>
    </blockquote>
 <!--TAGS: . ~/Scripting -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_debugging.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191113X_static_code_analysis_module_in_perl_stack_overflow"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191112X_lib_module_checkstyle_pm" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191112X_static_code_analysis_module_in_perl_stack_overflow"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 12, 2019] <a target="_blank" href="https://metacpan.org/release/Module-Checkstyle/source/lib/Module/Checkstyle.pm">lib-Module-Checkstyle.pm </a></h4>

<blockquote>
<h6>Nov 12, 2019 |  <a target="_blank" href= "https://metacpan.org/release/Module-Checkstyle/source/lib/Module/Checkstyle.pm">metacpan.org</a></h6>
 

    <p>Module::Checkstyle is a tool similar to checkstyle <a target="_blank" href=
    "http://checkstyle.sourceforge.net/">http://checkstyle.sourceforge.net</a> for Java. It allows
    you to validate that your code confirms to a set of guidelines checking various things such as
    indentation, naming, whitespace, complexity and so forth.</p>

    <p>Module::Checkstyle is also extensible so your organization can implement custom checks that
    are not provided by the standard distribution. There is a guide on how to write checks in
    <a target="_blank" href=
    "https://metacpan.org/pod/release/CLAESJAC/Module-Checkstyle-0.04/lib/Module/Checkstyle/Check.pm">
    Module::Checkstyle::Check</a></p>

    <p>Module::Checkstyle is mostly used via the provided <code>module-checkstyle</code> tool. You
    probablly want to read <a target="_blank" href=
    "https://metacpan.org/pod/release/CLAESJAC/Module-Checkstyle-0.04/bin/module-checkstyle">module-checkstyle</a>
    .</p>

    <blockquote>
      <b>NAME</b>

      <p>module-checkstyle - Check that your code keeps style</p><b>SYNOPSIS</b>

      <p>module-checkstyle [options] [file and directories ...]</p>

      <p><b>This program</b> is the command-line interface to <b>Module::Checkstyle</b> .</p>

      <p>You invoke it by supplying a list of files or directories that contain Perl code that
      should be checked aginst the configuration. Any problems found will be reported on standard
      out.</p><b>OPTIONS</b>

      <dl>
        <dt><b>-help</b></dt>

        <dd>Print a brief help message and exits.</dd>

        <dt><b>-man</b></dt>

        <dd>Prints the manual page and exists.</dd>

        <dt><b>-config</b></dt>

        <dd>Use an alternate config file instead of <i>~/.module-checkstyle/config</i> .</dd>

        <dt><b>-all</b></dt>

        <dd>Don't ignore common files when traversing directories. Common files are things such as
        blib/* t/* Makefile.PL etc.</dd>

        <dt><b>-debug</b></dt>

        <dd>Turn on debugging information.</dd>

        <dt><b>-version</b></dt>

        <dd>Display version information.</dd>
      </dl>
    </blockquote>
 <!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_debugging.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191112X_lib_module_checkstyle_pm"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191112X_static_code_analysis_module_in_perl_stack_overflow" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191112X_lib_module_checkstyle_pm_metacpan_org"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 12, 2019] <a target="_blank" href="https://stackoverflow.com/questions/10991702/static-code-analysis-module-in-perl">Static code   analysis module in Perl - Stack Overflow</a></h4>

<blockquote>
<h6>Nov 12, 2019 |  <a target="_blank" href= "https://stackoverflow.com/questions/10991702/static-code-analysis-module-in-perl">stackoverflow.com</a></h6>
 

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/questions/10991702/static-code-analysis-module-in-perl">Static code
    analysis module in Perl</a></b> <a target="_blank" href=
    "https://stackoverflow.com/questions/ask">Ask Question</a> Asked 7 years, 5 months ago Active
    <a target="_blank" href=
    "https://stackoverflow.com/questions/10991702/static-code-analysis-module-in-perl?lastactivity">
    1 year, 7 months ago</a> Viewed 835 times 0</p>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/716443/davido">DavidO</a></b>
    ,Jun 12, 2012 at 9:13</p>

    <blockquote>
      Is there any static code analysis module in Perl except B::Lint and Perl::Critic? How
      effective is Module::Checkstyle?
    </blockquote>

    <p><b>></b> ,</p>

    <blockquote>
      There is a <a target="_blank" href="http://www.perlmonks.org/?node_id=943316">post</a> on
      perlmonks.org asking if PPI can be used for static analysis. PPI is the power behind
      Perl::Critic, according to the <a target="_blank" href=
      "http://cpanratings.perl.org/dist/PPI">reviews</a> of this module. (I have not used it yet).

      <p>Then there is <a target="_blank" href="http://en.wikipedia.org/wiki/PerlTidy">perltidy</a>
      .</p>
    </blockquote>
 <!--TAGS: . ~/Scripting -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_debugging.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191112X_static_code_analysis_module_in_perl_stack_overflow"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191112X_lib_module_checkstyle_pm_metacpan_org" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191111X_how_fast_is_perl_s_smartmatch_operator_when_searching_for_a_scalar_in_an_array_stack"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 12, 2019] <a target="_blank" href="https://metacpan.org/release/Module-Checkstyle/source/lib/Module/Checkstyle.pm">lib-Module-Checkstyle.pm   - metacpan.org</a></h4>

<blockquote>
<h6>Nov 12, 2019 |  <a target="_blank" href= "https://metacpan.org/release/Module-Checkstyle/source/lib/Module/Checkstyle.pm">metacpan.org</a></h6>
 

    <p>Module::Checkstyle is a tool similar to checkstyle <a target="_blank" href=
    "http://checkstyle.sourceforge.net/">http://checkstyle.sourceforge.net</a> for Java. It allows
    you to validate that your code confirms to a set of guidelines checking various things such as
    indentation, naming, whitespace, complexity and so forth.</p>

    <p>Module::Checkstyle is also extensible so your organization can implement custom checks that
    are not provided by the standard distribution. There is a guide on how to write checks in
    <a target="_blank" href=
    "https://metacpan.org/pod/release/CLAESJAC/Module-Checkstyle-0.04/lib/Module/Checkstyle/Check.pm">
    Module::Checkstyle::Check</a></p>

    <p>Module::Checkstyle is mostly used via the provided <code>module-checkstyle</code> tool. You
    probablly want to read <a target="_blank" href=
    "https://metacpan.org/pod/release/CLAESJAC/Module-Checkstyle-0.04/bin/module-checkstyle">module-checkstyle</a>
    .</p>

    <blockquote>
      <b>NAME</b>

      <p>module-checkstyle - Check that your code keeps style</p><b>SYNOPSIS</b>

      <p>module-checkstyle [options] [file and directories ...]</p>

      <p><b>This program</b> is the command-line interface to <b>Module::Checkstyle</b> .</p>

      <p>You invoke it by supplying a list of files or directories that contain Perl code that
      should be checked aginst the configuration. Any problems found will be reported on standard
      out.</p><b>OPTIONS</b>

      <dl>
        <dt><b>-help</b></dt>

        <dd>Print a brief help message and exits.</dd>

        <dt><b>-man</b></dt>

        <dd>Prints the manual page and exists.</dd>

        <dt><b>-config</b></dt>

        <dd>Use an alternate config file instead of <i>~/.module-checkstyle/config</i> .</dd>

        <dt><b>-all</b></dt>

        <dd>Don't ignore common files when traversing directories. Common files are things such as
        blib/* t/* Makefile.PL etc.</dd>

        <dt><b>-debug</b></dt>

        <dd>Turn on debugging information.</dd>

        <dt><b>-version</b></dt>

        <dd>Display version information.</dd>
      </dl>
    </blockquote>
 <!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_debugging.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191112X_lib_module_checkstyle_pm_metacpan_org"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191111X_how_fast_is_perl_s_smartmatch_operator_when_searching_for_a_scalar_in_an_array_stack" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191111X_what_are_the_best_tools_for_python_static_analysis"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 11, 2019] <a target="_blank" href="https://stackoverflow.com/questions/3951812/how-fast-is-perls-smartmatch-operator-when-searching-for-a-scalar-in-an-array">   How fast is Perl's smartmatch operator when searching for a scalar in an array - Stack   Overflow</a></h4>

<blockquote>
<h6>Nov 11, 2019 |  <a target="_blank" href= "https://stackoverflow.com/questions/3951812/how-fast-is-perls-smartmatch-operator-when-searching-for-a-scalar-in-an-array"> stackoverflow.com</a></h6>
 
 

    <ul>
      <li><a target="_blank" href="https://stackoverflow.com/">Home</a></li>

      <li>
        <ol>
          <li>Public</li>

          <li><a target="_blank" href="https://stackoverflow.com/questions">Stack Overflow</a></li>

          <li><a target="_blank" href="https://stackoverflow.com/tags">Tags</a></li>

          <li><a target="_blank" href="https://stackoverflow.com/users">Users</a></li>

          <li><a target="_blank" href=
          "https://stackoverflow.com/jobs?so_medium=StackOverflow&so_source=SiteNav">Jobs</a></li>
        </ol>
      </li>

      <li>
        <ol>
          <li>Teams <a role="button" aria-controls="popover-teams-create-cta" data-gps-track=
          "teams.create.left-sidenav.click({ Action: ShowInfo })" data-ga=
          "["teams left navigation - anonymous","left nav show teams info",null,null,null]"
            data-s-popover-placement="bottom-start" data-action="s-popover#toggle" data-controller=
            "s-popover" data-s-popover-toggle-class="is-selected" href="javascript:void(0)">What's
            this?</a>

            <p>Teams</p>

            <p>Q&A for Work</p>

            <p>Stack Overflow for Teams is a private, secure spot for you and your coworkers to
            find and share information.</p><a target="_blank" href=
            "https://stackoverflow.com/teams">Learn more</a>
          </li>

          <li><a target="_blank" href="https://stackoverflow.com/teams">First 10 Free</a></li>
        </ol>
      </li>

      <li style="list-style: none">
        <b><a target="_blank" href=
        "https://stackoverflow.com/questions/3951812/how-fast-is-perls-smartmatch-operator-when-searching-for-a-scalar-in-an-array">
        How fast is Perl's smartmatch operator when searching for a scalar in an array?</a></b>
        <a target="_blank" href="https://stackoverflow.com/questions/ask">Ask Question</a> Asked 8
        years, 11 months ago Active <a target="_blank" href=
        "https://stackoverflow.com/questions/3951812/how-fast-is-perls-smartmatch-operator-when-searching-for-a-scalar-in-an-array?lastactivity">
        3 years ago</a> Viewed 5k times 18 6
        <hr noshade align="left" width="10" size="10">

        <p><b><a target="_blank" href="https://stackoverflow.com/users/3333/paul-tomblin">Paul
        Tomblin</a></b> ,Oct 19, 2010 at 13:38</p>

        <blockquote>
          I want to repeatedly search for values in an array that does not change.

          <p>So far, I have been doing it this way: I put the values in a hash (so I have an array
          and a hash with essentially the same contents) and I search the hash using
          <code>exists</code> .</p>

          <p>I don't like having two different variables (the array and the hash) that both store
          the same thing; however, the hash is much faster for searching.</p>

          <p>I found out that there is a <code>~~</code> (smartmatch) operator in Perl 5.10. How
          efficient is it when searching for a scalar in an array?</p>
        </blockquote>

        <p><b>></b> ,</p>

        <blockquote>
          If you want to search for a single scalar in an array, you can use <a target="_blank" href="http://search.cpan.org/dist/List-Util">List::Util</a> 's <code>first</code>
          subroutine. It stops as soon as it knows the answer. I don't expect this to be faster
          than a hash lookup <i>if you already have the hash</i> , but when you consider creating
          the hash and having it in memory, it might be more convenient for you to just search the
          array you already have.

          <p>As for the smarts of the smart-match operator, if you want to see how smart it is,
          test it. :)</p>

          <p>There are at least three cases you want to examine. The worst case is that every
          element you want to find is at the end. The best case is that every element you want to
          find is at the beginning. The likely case is that the elements you want to find average
          out to being in the middle.</p>

          <p>Now, before I start this benchmark, I expect that if the smart match can short circuit
          (and it can; its documented in <a target="_blank" href=
          "http://perldoc.perl.org/perlsyn.html">perlsyn</a> ), that the best case times will stay
          the same despite the array size, while the other ones get increasingly worse. If it can't
          short circuit and has to scan the entire array every time, there should be no difference
          in the times because every case involves the same amount of work.</p>

          <p>Here's a benchmark:</p>
          <pre>
#!perl
use 5.12.2;
use strict;
use warnings;

use Benchmark qw(cmpthese);

my @hits = qw(A B C);
my @base = qw(one two three four five six) x ( $ARGV[0] || 1 );

my @at_end       = ( @base, @hits );
my @at_beginning = ( @hits, @base );

my @in_middle = @base;
splice @in_middle, int( @in_middle / 2 ), 0, @hits;

my @random = @base;
foreach my $item ( @hits ) {
    my $index = int rand @random;
    splice @random, $index, 0, $item;
    }

sub count {
    my( $hits, $candidates ) = @_;

    my $count;
    foreach ( @$hits ) { when( $candidates ) { $count++ } }
    $count;
    }

cmpthese(-5, {
    hits_beginning => sub { my $count = count( \@hits, \@at_beginning ) },
    hits_end       => sub { my $count = count( \@hits, \@at_end ) },
    hits_middle    => sub { my $count = count( \@hits, \@in_middle ) },
    hits_random    => sub { my $count = count( \@hits, \@random ) },
    control        => sub { my $count = count( [], [] ) },
  }
);
</pre>div class="answercell post-layout--right
        </blockquote>

        <p>,</p>

        <blockquote>
          Here's how the various parts did. Note that this is a logarithmic plot on both axes, so
          the slopes of the plunging lines aren't as close as they look:

          <p>So, it looks like the smart match operator is a bit smart, but that doesn't really
          help you because you still might have to scan the entire array. You probably don't know
          ahead of time where you'll find your elements. I expect a hash will perform the same as
          the best case smart match, even if you have to give up some memory for it.</p>
          <hr>

          <p>Okay, so the smart match being smart times two is great, but the real question is
          "Should I use it?". The alternative is a hash lookup, and it's been bugging me that I
          haven't considered that case.</p>

          <p>As with any benchmark, I start off thinking about what the results might be before I
          actually test them. I expect that if I already have the hash, looking up a value is going
          to be lightning fast. That case isn't a problem. I'm more interested in the case where I
          don't have the hash yet. How quickly can I make the hash and lookup a key? I expect that
          to perform not so well, but is it still better than the worst case smart match?</p>

          <p>Before you see the benchmark, though, remember that there's almost never enough
          information about which technique you should use just by looking at the numbers. The
          context of the problem selects the best technique, not the fastest, contextless
          micro-benchmark. Consider a couple of cases that would select different techniques:</p>

          <ul>
            <li>You have one array you will search repeatedly</li>

            <li>You always get a new array that you only need to search once</li>

            <li>You get very large arrays but have limited memory</li>
          </ul>

          <p>Now, keeping those in mind, I add to my previous program:</p>
          <pre>
my %old_hash = map {$_,1} @in_middle; 

cmpthese(-5, {
    ...,
    new_hash       => sub { 
        my %h = map {$_,1} @in_middle; 
        my $count = 0;
        foreach ( @hits ) { $count++ if exists $h{$_} }
        $count;
        },
    old_hash       => sub { 
        my $count = 0;
        foreach ( @hits ) { $count++ if exists $old_hash{$_} }
        $count;
        },
    control_hash   => sub { 
        my $count = 0;
        foreach ( @hits ) { $count++ }
        $count;
        },
    }
);
</pre>

          <p>Here's the plot. The colors are a bit difficult to distinguish. The lowest line there
          is the case where you have to create the hash any time you want to search it. That's
          pretty poor. The highest two (green) lines are the control for the hash (no hash actually
          there) and the existing hash lookup. This is a log/log plot; those two cases are faster
          than even the smart match control (which just calls a subroutine).</p>

          <p>There are a few other things to note. The lines for the "random" case are a bit
          different. That's understandable because each benchmark (so, once per array scale run)
          randomly places the hit elements in the candidate array. Some runs put them a bit earlier
          and some a bit later, but since I only make the <code>@random</code> array once per run
          of the entire program, they move around a bit. That means that the bumps in the line
          aren't significant. If I tried all positions and averaged, I expect that "random" line to
          be the same as the "middle" line.</p>

          <p>Now, looking at these results, I'd say that a smart-match is much faster in its worst
          case than the hash lookup is in its worst case. That makes sense. To create a hash, I
          have to visit every element of the array and also make the hash, which is a lot of
          copying. There's no copying with the smart match.</p>

          <p>Here's a further case I won't examine though. When does the hash become better than
          the smart match? That is, when does the overhead of creating the hash spread out enough
          over repeated searches that the hash is the better choice?</p>
        </blockquote>

        <p>,</p>

        <blockquote>
          Fast for small numbers of potential matches, but not faster than the hash. Hashes are
          really the right tool for testing set membership. Since hash access is O(log n) and
          smartmatch on an array is still O(n) linear scan (albeit short-circuiting, unlike grep),
          with larger numbers of values in the allowed matches, smartmatch gets relatively worse.
          <b>Benchmark code (matching against 3 values):</b>
          <pre>
#!perl
use 5.12.0;
use Benchmark qw(cmpthese);

my @hits = qw(one two three);
my @candidates = qw(one two three four five six); # 50% hit rate
my %hash;
@hash{@hits} = ();

sub count_hits_hash {
  my $count = 0;
  for (@_) {
    $count++ if exists $hash{$_};
  }
  $count;
}

sub count_hits_smartmatch {
  my $count = 0;
  for (@_) {
    $count++ when @hits;
  }
  $count;
}

say count_hits_hash(@candidates);
say count_hits_smartmatch(@candidates);

cmpthese(-5, {
    hash => sub { count_hits_hash((@candidates) x 1000) },
    smartmatch => sub { count_hits_smartmatch((@candidates) x 1000) },
  }
);
</pre><b>Benchmark results:</b>
          <pre>
             Rate smartmatch       hash
smartmatch  404/s         --       -65%
hash       1144/s       183%         --
</pre>
        </blockquote>
      </li>
    </ul>
 <!--TAGS: . ~/Scripting -->

<!--file:///f:/Public_html/Scripting/Perlorama/Variables/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>


</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191111X_how_fast_is_perl_s_smartmatch_operator_when_searching_for_a_scalar_in_an_array_stack"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191111X_what_are_the_best_tools_for_python_static_analysis" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191111X_what_are_the_best_tools_for_python_static_analysis_quora"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 11, 2019] <a target="_blank" href="https://www.quora.com/What-are-the-best-tools-for-Python-static-analysis">What are the best tools for Python static  analysis  </a></h4>

<blockquote>
<h6>Nov 11, 2019 |  <a target="_blank" href="https://www.quora.com/What-are-the-best-tools-for-Python-static-analysis">www.quora.com </a> </h6>
 
<p>
 <hr noshade align="left" width="10" size="10">
<p>
<a target="_blank" href="https://www.quora.com/profile/Christoph-Neumann">
                                                                           Christoph Neumann


                                                                           Answered

Jun 
                                                                           6 2015
</a>
<blockquote>

   <p>For web workflows check out

<a target="_blank" href="https://www.quantifiedcode.com/">QuantifiedCode
</a>.  It's a data-driven code quality 
                                                                  platform we've built to automate code reviews. It offers you 
                                                                  static analysis as a service--for free.

   <p>Other tools out there are
<a target="_blank" href="http://pylint.org/">Pylint
</a>,
<a target="_blank" href="https://launchpad.net/pyflakes">PyFlakes
</a>,
<a target="_blank" href="http://pychecker.sourceforge.net/">PyChecker
</a>,
<a target="_blank" href="https://github.com/jcrocholl/pep8">PEP8
</a>,
<a target="_blank" href="https://github.com/timothycrosley/frosted">Frosted
</a>(a fork of PyFlakes) and <a target="_blank" href="http://flake8.readthedocs.org/en/latest/">Flake8
</a>(a wrapper around PyFlakes and PEP8).

   <p>For more details, I compiled a tables that compares the most 
                                                                  popular
   <a target="_blank" href="http://blog.quantifiedcode.com/python-code-analysis-tools-overview/">Python code analysis tools
</a>.

                                                                  7.3k views
 ·
<a target="_blank" href="https://www.quora.com/What-are-the-best-tools-for-Python-static-analysis#">View 3 Upvoters </a><b>Related Questions
   <a target="_blank" href="https://www.quora.com/What-are-the-best-tools-for-Python-static-analysis#MoreAnswers">More 
                                                Answers Below
</a></b>
</blockquote>
<ul>
<li>
<a target="_blank" href="https://www.quora.com/What-are-some-static-code-analysis-tools-for-Python-specifically-to-identify-insecure-coding-practices">
What are some static code 
                                                               analysis tools for Python, specifically to identify insecure coding 
                                                               practices?
</a>
</li>
<li>
<a target="_blank" href="https://www.quora.com/unanswered/What-are-static-analysis-tools-and-which-are-the-best-tools">
What are static analysis tools, 
                                                               and which are the best tools?
</a>
</li>
<li>
<a target="_blank" href="https://www.quora.com/What-is-the-best-IDE-for-Python">
What is the best IDE for 
                                                               Python?
</a>
</li>
<li>
<a target="_blank" href="https://www.quora.com/As-a-data-scientist-do-you-use-more-R-or-Python-or-is-it-about-the-same">
As a data scientist, do you use 
                                                               more R or Python or is it about the same?
</a>
</li>
<li>
<a target="_blank" href="https://www.quora.com/What-are-some-pros-and-cons-of-using-Python-for-data-science">
What are some pros and cons of 
                                                               using Python for data science?
</a>
</li>
</ul>
<a target="_blank" href="https://www.quora.com/profile/Guillaume-Bog">
                                                                           Guillaume Bog
</a>
, 
                                                                           Python supertanker maintenance
<a target="_blank" href="https://www.quora.com/What-are-the-best-tools-for-Python-static-analysis/answer/Guillaume-Bog">
                                                                           Answered Jul 9, 2012
</a>

 

                                                                  Originally Answered:

<a target="_blank" href="https://www.quora.com/What-is-the-best-static-analysis-tool-for-Python?no_redirect=1">
What is the best static 
                                                                  analysis tool for Python?
</a>
<blockquote>

   <p>I use pyflakes for code 
                                                                  checking inside Vim and find it very useful. But still, pylint is 
                                                                  better for pre-commit code checking. You should have two levels of 
                                                                  code checking: errors that cannot be commited and warnings that 
                                                                  are code-smells but can be commited. You can configure that and 
                                                                  many other things with pylint. </p>

   <p>Sometime you might think pylint is too picky: it may complain for 
                                                                  something that you think is perfectly ok. Think twice about it. 
                                                                  Very often, I found that the warning I found overly conservative 
                                                                  some month ago was actually a very good advice.

   <p>So my answer is that pylint is reliable and robust, and I am not aware of a much better code analyzer.  

   <p> pylint is very good for 
                                                                  respecting PEP8

   <p>you can have pyflakes directly embedded in vim with this plugin: <br>
   <a target="_blank" href="http://www.vim.org/scripts/script.php?script_id=2441">http://www.vim.org/scripts/scrip...
</a>
</blockquote>

<p>
<a target="_blank" href="https://www.quora.com/profile/Alexa-Alice-3">
                                                                           Alexa Alice


                                                                           Answered Jul 24, 2019
</a>
 ·

Author has
278
 
                                                                           answers and
53.4k
 answer 
                                                                           views
<blockquote>

   <p>Spending time 
                                                                  in the static analysis will really(really) advantage you and your 
                                                                  group as far as time spending on discovering bugs, as far as 
                                                                  disclosing the code to extend newcomers, regarding undertaking 
                                                                  costs and so on. On the off chance that you invest the energy 
                                                                  doing it forthrightly, it might appear as though you're not 
                                                                  chipping away at highlights but rather it will return to you later 
                                                                  on you will profit by this sooner or later. </p>

   <p>There are a 
                                                                  couple of interesting points on our voyage for brilliant code. In 
                                                                  the first place, this adventure isn't one of unadulterated 
                                                                  objectivity. There are some solid sentiments of what top-notch 
                                                                  code resembles.
</p>

   <p>While everybody 
                                                                  can ideally concede to the identifiers referenced over, the manner 
                                                                  in which they get accomplished is an emotional street. The most 
                                                                  obstinate themes generally come up when you talk about 
                                                                  accomplishing intelligibility, upkeep, and extensibility.
</p>

   <p>To know more

<a target="_blank" href="https://www.veracode.com/products/binary-static-analysis-sast">details: Static Analysis
</a>342 views

 


<b>Related Questions
<a target="_blank" href="https://www.quora.com/What-are-the-best-tools-for-Python-static-analysis#MoreAnswers">More 
                                                Answers Below
</a></b>
</blockquote>
<ul>

   <li><a target="_blank" href="https://www.quora.com/As-a-data-scientist-do-you-use-more-R-or-Python-or-is-it-about-the-same">As a data scientist, do you use 
                                                               more R or Python or is it about the same?
</a></li>

   <li><a target="_blank" href="https://www.quora.com/What-are-some-pros-and-cons-of-using-Python-for-data-science">What are some pros and cons of 
                                                               using Python for data science?
</a></li>

   <li><a target="_blank" href="https://www.quora.com/What-are-the-tools-available-for-R-programming">What are the tools available 
                                                               for R programming?
</a></li>

   <li><a target="_blank" href="https://www.quora.com/What-are-some-best-tools-to-do-static-analysis-of-code-in-PHP">What are some best tools to do 
                                                               static analysis of code in PHP?
</a></li>

   <li><a target="_blank" href="https://www.quora.com/How-do-I-learn-static-program-analysis">How do I learn static program 
                                                               analysis?
</a></li>
</ul>

<p><a target="_blank" href="https://www.quora.com/profile/Dave-Wade-Stein">Dave Wade-Stein
</a>, 
                                                                           Senior Instructor at DevelopIntelligence (2015-present)
<a target="_blank" href="https://www.quora.com/What-are-the-best-tools-for-Python-static-analysis/answer/Dave-Wade-Stein">Answered Apr 15, 2018
</a>·

Author has
995
 
                                                                           answers and
2.1m
 answer 
                                                                           views

 


</p>
<blockquote>

   <p>And if you're 
                                                                  using Python 3.6+, you can add typing hints to your code and run

   <a target="_blank" href="http://mypy-lang.org/">mypy
</a>, a static typechecker over your code. 
                                                                  (Technically, <b>mypy
</b>will work with Python 2 code as well, 
                                                                  but given that typing hints weren't added to Python until 3.5, you 
                                                                  have to put the typing hints in comments which is a bit cumbersome 
                                                                  and hard to maintain.)

</p>
</blockquote>


<!--TAGS: . ~/Perl -->

<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
</blockquote>


</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191111X_what_are_the_best_tools_for_python_static_analysis"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191111X_what_are_the_best_tools_for_python_static_analysis_quora" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191110X_with_the_rename_from_perl_6_to_racu_chances_of_mass_adoption_of_the_new_language_probably"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 11, 2019] <a target="_blank" href="https://www.quora.com/What-are-the-best-tools-for-Python-static-analysis">What are the best tools for Python static  analysis - Quora </a></h4>

<blockquote>
<h6>Nov 11, 2019 |  <a target="_blank" href="https://www.quora.com/What-are-the-best-tools-for-Python-static-analysis">www.quora.com </a> </h6>
 
<p>
<b>
What are the best tools for Python static analysis?
</b>
<hr noshade align="left" width="10" size="10">
<p>
<a target="_blank" href="https://www.quora.com/profile/Christoph-Neumann">
                                                                           Christoph Neumann


                                                                           Answered

Jun 
                                                                           6 2015
</a>
<blockquote>

   <p>For web workflows check out

<a target="_blank" href="https://www.quantifiedcode.com/">QuantifiedCode
</a>.  It's a data-driven code quality 
                                                                  platform we've built to automate code reviews. It offers you 
                                                                  static analysis as a service--for free.

   <p>Other tools out there are
<a target="_blank" href="http://pylint.org/">Pylint
</a>,
<a target="_blank" href="https://launchpad.net/pyflakes">PyFlakes
</a>,
<a target="_blank" href="http://pychecker.sourceforge.net/">PyChecker
</a>,
<a target="_blank" href="https://github.com/jcrocholl/pep8">PEP8
</a>,
<a target="_blank" href="https://github.com/timothycrosley/frosted">Frosted
</a>(a fork of PyFlakes) and <a target="_blank" href="http://flake8.readthedocs.org/en/latest/">Flake8
</a>(a wrapper around PyFlakes and PEP8).

   <p>For more details, I compiled a tables that compares the most 
                                                                  popular
   <a target="_blank" href="http://blog.quantifiedcode.com/python-code-analysis-tools-overview/">Python code analysis tools
</a>.

                                                                  7.3k views
 ·
<a target="_blank" href="https://www.quora.com/What-are-the-best-tools-for-Python-static-analysis#">View 3 Upvoters </a><b>Related Questions
   <a target="_blank" href="https://www.quora.com/What-are-the-best-tools-for-Python-static-analysis#MoreAnswers">More 
                                                Answers Below
</a></b>
</blockquote>
<ul>
<li>
<a target="_blank" href="https://www.quora.com/What-are-some-static-code-analysis-tools-for-Python-specifically-to-identify-insecure-coding-practices">
What are some static code 
                                                               analysis tools for Python, specifically to identify insecure coding 
                                                               practices?
</a>
</li>
<li>
<a target="_blank" href="https://www.quora.com/unanswered/What-are-static-analysis-tools-and-which-are-the-best-tools">
What are static analysis tools, 
                                                               and which are the best tools?
</a>
</li>
<li>
<a target="_blank" href="https://www.quora.com/What-is-the-best-IDE-for-Python">
What is the best IDE for 
                                                               Python?
</a>
</li>
<li>
<a target="_blank" href="https://www.quora.com/As-a-data-scientist-do-you-use-more-R-or-Python-or-is-it-about-the-same">
As a data scientist, do you use 
                                                               more R or Python or is it about the same?
</a>
</li>
<li>
<a target="_blank" href="https://www.quora.com/What-are-some-pros-and-cons-of-using-Python-for-data-science">
What are some pros and cons of 
                                                               using Python for data science?
</a>
</li>
</ul>
<a target="_blank" href="https://www.quora.com/profile/Guillaume-Bog">
                                                                           Guillaume Bog
</a>
, 
                                                                           Python supertanker maintenance
<a target="_blank" href="https://www.quora.com/What-are-the-best-tools-for-Python-static-analysis/answer/Guillaume-Bog">
                                                                           Answered Jul 9, 2012
</a>

 

                                                                  Originally Answered:

<a target="_blank" href="https://www.quora.com/What-is-the-best-static-analysis-tool-for-Python?no_redirect=1">
What is the best static 
                                                                  analysis tool for Python?
</a>
<blockquote>

   <p>I use pyflakes for code 
                                                                  checking inside Vim and find it very useful. But still, pylint is 
                                                                  better for pre-commit code checking. You should have two levels of 
                                                                  code checking: errors that cannot be commited and warnings that 
                                                                  are code-smells but can be commited. You can configure that and 
                                                                  many other things with pylint. </p>

   <p>Sometime you might think pylint is too picky: it may complain for 
                                                                  something that you think is perfectly ok. Think twice about it. 
                                                                  Very often, I found that the warning I found overly conservative 
                                                                  some month ago was actually a very good advice.

   <p>So my answer is that pylint is reliable and robust, and I am not aware of a much better code analyzer.  

   <p> pylint is very good for 
                                                                  respecting PEP8

   <p>you can have pyflakes directly embedded in vim with this plugin: <br>
   <a target="_blank" href="http://www.vim.org/scripts/script.php?script_id=2441">http://www.vim.org/scripts/scrip...
</a>
</blockquote>

<p>
<a target="_blank" href="https://www.quora.com/profile/Alexa-Alice-3">
                                                                           Alexa Alice


                                                                           Answered Jul 24, 2019
</a>
 ·

Author has
278
 
                                                                           answers and
53.4k
 answer 
                                                                           views
<blockquote>

   <p>Spending time 
                                                                  in the static analysis will really(really) advantage you and your 
                                                                  group as far as time spending on discovering bugs, as far as 
                                                                  disclosing the code to extend newcomers, regarding undertaking 
                                                                  costs and so on. On the off chance that you invest the energy 
                                                                  doing it forthrightly, it might appear as though you're not 
                                                                  chipping away at highlights but rather it will return to you later 
                                                                  on you will profit by this sooner or later. </p>

   <p>There are a 
                                                                  couple of interesting points on our voyage for brilliant code. In 
                                                                  the first place, this adventure isn't one of unadulterated 
                                                                  objectivity. There are some solid sentiments of what top-notch 
                                                                  code resembles.
</p>

   <p>While everybody 
                                                                  can ideally concede to the identifiers referenced over, the manner 
                                                                  in which they get accomplished is an emotional street. The most 
                                                                  obstinate themes generally come up when you talk about 
                                                                  accomplishing intelligibility, upkeep, and extensibility.
</p>

   <p>To know more

<a target="_blank" href="https://www.veracode.com/products/binary-static-analysis-sast">details: Static Analysis
</a>342 views

 


<b>Related Questions
<a target="_blank" href="https://www.quora.com/What-are-the-best-tools-for-Python-static-analysis#MoreAnswers">More 
                                                Answers Below
</a></b>
</blockquote>
<ul>

   <li><a target="_blank" href="https://www.quora.com/As-a-data-scientist-do-you-use-more-R-or-Python-or-is-it-about-the-same">As a data scientist, do you use 
                                                               more R or Python or is it about the same?
</a></li>

   <li><a target="_blank" href="https://www.quora.com/What-are-some-pros-and-cons-of-using-Python-for-data-science">What are some pros and cons of 
                                                               using Python for data science?
</a></li>

   <li><a target="_blank" href="https://www.quora.com/What-are-the-tools-available-for-R-programming">What are the tools available 
                                                               for R programming?
</a></li>

   <li><a target="_blank" href="https://www.quora.com/What-are-some-best-tools-to-do-static-analysis-of-code-in-PHP">What are some best tools to do 
                                                               static analysis of code in PHP?
</a></li>

   <li><a target="_blank" href="https://www.quora.com/How-do-I-learn-static-program-analysis">How do I learn static program 
                                                               analysis?
</a></li>
</ul>

<p><a target="_blank" href="https://www.quora.com/profile/Dave-Wade-Stein">Dave Wade-Stein
</a>, 
                                                                           Senior Instructor at DevelopIntelligence (2015-present)
<a target="_blank" href="https://www.quora.com/What-are-the-best-tools-for-Python-static-analysis/answer/Dave-Wade-Stein">Answered Apr 15, 2018
</a>·

Author has
995
 
                                                                           answers and
2.1m
 answer 
                                                                           views

 


</p>
<blockquote>

   <p>And if you're 
                                                                  using Python 3.6+, you can add typing hints to your code and run

   <a target="_blank" href="http://mypy-lang.org/">mypy
</a>, a static typechecker over your code. 
                                                                  (Technically, <b>mypy
</b>will work with Python 2 code as well, 
                                                                  but given that typing hints weren't added to Python until 3.5, you 
                                                                  have to put the typing hints in comments which is a bit cumbersome 
                                                                  and hard to maintain.)

</p>
</blockquote>


<!--TAGS: . ~/Perl -->

<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
</blockquote>


</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191111X_what_are_the_best_tools_for_python_static_analysis_quora"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191110X_with_the_rename_from_perl_6_to_racu_chances_of_mass_adoption_of_the_new_language_probably" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191108X_perl_tricks_for_system_administrators"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 10, 2019] <a target="_blank" href="https://news.ycombinator.com/item?id=10345728">With   the rename from Perl 6 to Racu chances of mass adoption of the new language probably evaporated</a></h4>

<h5>Racu now needs to compete on its own merits with
  established languages which is extremely difficult as Ruby  and Python covers the same application area</h5>
<h5>This is a positive decision for Perl5 as it slowly returns to its main niche -- the tool for
  advanced Unix sysadmins. Still as the decision was made rather late in language development cycle
  itt will negativly affect Racu future, if it has any. The main interest in the new language was
  because of the name -- Perl6. No this is gone.</h5>
<h5>It also split the community into Perl 5 supporters and "coming to Racu" beta addicts which is
  probably a good thing. But, at the same time, the loss of mindshare to Ruby and Python might
  accelerate.</h5>
<h5>Wikipedia already jumped the bandwagon: <a target="_blank" href=
  "https://en.wikipedia.org/wiki/Raku_(programming_language)">https://en.wikipedia.org/wiki/Raku_(programming_language)</a></h5>
<h5>For changes in the language see <a target="_blank" href=
  "https://docs.perl6.org/language/5to6-nutshell">https://docs.perl6.org/language/5to6-nutshell</a>
  They are not convincing</h5>
<blockquote>
<h6>Nov 10, 2019 |  <a target="_blank" href= "https://news.ycombinator.com/item?id=10345728">news.ycombinator.com</a></h6>
 <a target="_blank" href="https://news.ycombinator.com/user?id=makecheck">makecheck on Oct 7, 2015 [-]</a><br>
    In multiple organizations I have primarily seen Perl used in a very large, complex and
    established code bases that also make significant use of things like reading/writing Perl data
    structures. 
 <!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191110X_with_the_rename_from_perl_6_to_racu_chances_of_mass_adoption_of_the_new_language_probably"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191108X_perl_tricks_for_system_administrators" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191022X_is_there_an_advantage_to_using_bash_over_perl_or_python"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Nov 08, 2019] <a target="_blank" href="https://opensource.com/life/16/7/perl-tricks-system-administrators">Perl tricks for system   administrators</a> by <a target="_blank" href="https://opensource.com/users/druthb">Ruth Holloway   Feed</a></h4>

<h5>Notable quotes:</h5>
<h5>"...  /home/<department>/<username> ..."</h5>
<blockquote>
<h6>Jul 27, 2016 |  <a target="_blank" href= "https://opensource.com/life/16/7/perl-tricks-system-administrators">opensource.com</a></h6>
 

    <p>Did you know that Perl is a great programming language for system administrators? Perl is
    platform-independent so you can do things on different operating systems without rewriting your
    scripts. Scripting in Perl is quick and easy, and its portability makes your scripts amazingly
    useful. Here are a few examples, just to get your creative juices flowing! <b>Renaming a bunch
    of files</b></p>

    <p>Suppose you need to rename a whole bunch of files in a directory. In this case, we've got a
    directory full of <code>.xml</code> files, and we want to rename them all to <code>.html</code>
    . Easy-peasy!</p>#!/usr/bin/perl<br>
    use strict ;<br>
    use warnings ;

    <p>foreach my $file ( <a target="_blank" href=
    "http://perldoc.perl.org/functions/glob.html">glob</a> "*.xml" ) {<br>
    my $new = <a target="_blank" href="http://perldoc.perl.org/functions/substr.html">substr</a> (
    $file , 0 , - 3 ) . "html" ;<br>
    <a target="_blank" href="http://perldoc.perl.org/functions/rename.html">rename</a> $file , $new
    ;<br>
    }</p>

    <p>Then just cd to the directory where you need to make the change, and run the script. You
    could put this in a cron job, if you needed to run it regularly, and it is easily enhanced to
    accept parameters.</p>

    <p>Speaking of accepting parameters, let's take a look at a script that does just
    that.</p><b>Creating a Linux user account</b>

    <p>Programming and development</p>

    <ul>
      <li><a target="_blank" href=
      "https://opensource.com/downloads/cheat-sheets?intcmp=7016000000127cYAAQ">Programming cheat
      sheets</a></li>

      <li><a target="_blank" href=
      "https://opensource.com/tags/python?src=programming_resource_menu1">New Python
      content</a></li>

      <li><a target="_blank" href=
      "https://opensource.com/tags/javascript?src=programming_resource_menu2">Our latest JavaScript
      articles</a></li>

      <li><a target="_blank" href=
      "https://opensource.com/tags/perl?src=programming_resource_menu3">Recent Perl posts</a></li>

      <li><a target="_blank" href=
      "https://developers.redhat.com/?intcmp=7016000000127cYAAQ&src=programming_resource_menu4">
      Red Hat Developers Blog</a></li>
    </ul>

    <p>Suppose you need to regularly create Linux user accounts on your system, and the format of
    the username is first initial/last name, as is common in many businesses. (This is, of course,
    a good idea, until you get John Smith and Jane Smith working at the same company -- or want
    John to have two accounts, as he works part-time in two different departments. But humor me,
    okay?) Each user account needs to be in a group based on their department, and home directories
    are of the format <em>/home/<department>/<username></em> . Let's take a look at a
    script to do that:</p>#!/usr/bin/env perl<br>
    use strict ;<br>
    use warnings ;

    <p>my $adduser = '/usr/sbin/adduser' ;</p>

    <p>use Getopt :: Long <a target="_blank" href=
    "http://perldoc.perl.org/functions/qw.html">qw</a> ( GetOptions ) ;</p>

    <p># If the user calls the script with no parameters,<br>
    # give them help!</p>

    <p>if ( not @ ARGV ) {<br>
    usage () ;<br>
    }</p>

    <p># Gather our options; if they specify any undefined option,<br>
    # they'll get sent some help!</p>

    <p>my %opts ;<br>
    GetOptions ( \%opts ,<br>
    'fname=s' ,<br>
    'lname=s' ,<br>
    'dept=s' ,<br>
    'run' ,<br>
    ) or usage () ;</p>

    <p># Let's validate our inputs. All three parameters are<br>
    # required, and must be alphabetic.<br>
    # You could be clever, and do this with a foreach loop,<br>
    # but let's keep it simple for now.</p>

    <p>if ( not $opts { fname } or $opts { fname } !~ /^[a-zA-Z]+$/ ) {<br>
    usage ( "First name must be alphabetic" ) ;<br>
    }<br>
    if ( not $opts { lname } or $opts { lname } !~ /^[a-zA-Z]+$/ ) {<br>
    usage ( "Last name must be alphabetic" ) ;<br>
    }<br>
    if ( not $opts { dept } or $opts { dept } !~ /^[a-zA-Z]+$/ ) {<br>
    usage ( "Department must be alphabetic" ) ;<br>
    }</p>

    <p># Construct the username and home directory</p>

    <p>my $username = <a target="_blank" href="http://perldoc.perl.org/functions/lc.html">lc</a> (
    <a target="_blank" href="http://perldoc.perl.org/functions/substr.html">substr</a> ( $opts {
    fname } , 0 , 1 ) . $opts { lname }) ;<br>
    my $home = "/home/$opts{dept}/$username" ;</p>

    <p># Show them what we've got ready to go.</p>

    <p><a target="_blank" href="http://perldoc.perl.org/functions/print.html">print</a> "Name:
    $opts{fname} $opts{lname} \n " ;<br>
    <a target="_blank" href="http://perldoc.perl.org/functions/print.html">print</a> "Username:
    $username \n " ;<br>
    <a target="_blank" href="http://perldoc.perl.org/functions/print.html">print</a> "Department:
    $opts{dept} \n " ;<br>
    <a target="_blank" href="http://perldoc.perl.org/functions/print.html">print</a> "Home
    directory: $home \n\n " ;</p>

    <p># use qq() here, so that the quotes in the --gecos flag<br>
    # get carried into the command!</p>

    <p>my $cmd = <a target="_blank" href="http://perldoc.perl.org/functions/qq.html">qq</a> (
    $adduser -- home $home -- ingroup $opts { dept } \\<br>
    -- gecos "$opts{fname} $opts{lname}" $username ) ;</p>

    <p><a target="_blank" href="http://perldoc.perl.org/functions/print.html">print</a> "$cmd \n "
    ;<br>
    if ( $opts { run }) {<br>
    <a target="_blank" href="http://perldoc.perl.org/functions/system.html">system</a> $cmd ;<br>
    } else {<br>
    <a target="_blank" href="http://perldoc.perl.org/functions/print.html">print</a> "You need to
    add the --run flag to actually execute \n " ;<br>
    }</p>

    <p>sub usage {<br>
    my ( $msg ) = @_ ;<br>
    if ( $msg ) {<br>
    <a target="_blank" href="http://perldoc.perl.org/functions/print.html">print</a> "$msg \n\n "
    ;<br>
    }<br>
    <a target="_blank" href="http://perldoc.perl.org/functions/print.html">print</a> "Usage: $0
    --fname FirstName --lname LastName --dept Department --run \n " ;<br>
    <a target="_blank" href="http://perldoc.perl.org/functions/exit.html">exit</a> ;<br>
    }</p>

    <p>As with the previous script, there are opportunities for enhancement, but something like
    this might be all that you need for this task.</p>

    <p>One more, just for fun!</p><b>Change copyright text in every Perl source file in a directory
    tree</b>

    <p>Now we're going to try a mass edit. Suppose you've got a directory full of code, and each
    file has a copyright statement somewhere in it. (Rich Bowen wrote a great article, <a target=
    "_blank" href="https://opensource.com/law/14/2/copyright-statements-source-files">Copyright
    statements proliferate inside open source code</a> a couple of years ago that discusses the
    wisdom of copyright statements in open source code. It is a good read, and I recommend it
    highly. But again, humor me.) You want to change that text in each and every file in the
    directory tree. <code>File::Find</code> and <code>File::Slurp</code> are your
    friends!</p>#!/usr/bin/perl<br>
    use strict ;<br>
    use warnings ;

    <p>use File :: Find <a target="_blank" href="http://perldoc.perl.org/functions/qw.html">qw</a>
    ( find ) ;<br>
    use File :: Slurp <a target="_blank" href="http://perldoc.perl.org/functions/qw.html">qw</a> (
    read_file write_file ) ;</p>

    <p># If the user gives a directory name, use that. Otherwise,<br>
    # use the current directory.</p>

    <p>my $dir = $ARGV [ 0 ] || '.' ;</p>

    <p># File::Find::find is kind of dark-arts magic.<br>
    # You give it a reference to some code,<br>
    # and a directory to hunt in, and it will<br>
    # execute that code on every file in the<br>
    # directory, and all subdirectories. In this<br>
    # case, \&change_file is the reference<br>
    # to our code, a subroutine. You could, if<br>
    # what you wanted to do was really short,<br>
    # include it in a { } block instead. But doing<br>
    # it this way is nice and readable.</p>

    <p>find ( \&change_file , $dir ) ;</p>

    <p>sub change_file {<br>
    my $name = $_ ;</p>

    <p># If the file is a directory, symlink, or other<br>
    # non-regular file, don't do anything</p>

    <p>if ( not - f $name ) {<br>
    <a target="_blank" href="http://perldoc.perl.org/functions/return.html">return</a> ;<br>
    }<br>
    # If it's not Perl, don't do anything.</p>

    <p>if ( <a target="_blank" href="http://perldoc.perl.org/functions/substr.html">substr</a> (
    $name , - 3 ) ne ".pl" ) {<br>
    <a target="_blank" href="http://perldoc.perl.org/functions/return.html">return</a> ;<br>
    }<br>
    <a target="_blank" href="http://perldoc.perl.org/functions/print.html">print</a> "$name \n "
    ;</p>

    <p># Gobble up the file, complete with carriage<br>
    # returns and everything.<br>
    # Be wary of this if you have very large files<br>
    # on a system with limited memory!</p>

    <p>my $data = read_file ( $name ) ;</p>

    <p># Use a regex to make the change. If the string appears<br>
    # more than once, this will change it everywhere!</p>

    <p>$data =~ s/Copyright Old/Copyright New/g ;</p>

    <p># Let's not ruin our original files</p>

    <p>my $backup = "$name.bak" ;<br>
    <a target="_blank" href="http://perldoc.perl.org/functions/rename.html">rename</a> $name ,
    $backup ;<br>
    write_file ( $name , $data ) ;</p>

    <p><a target="_blank" href="http://perldoc.perl.org/functions/return.html">return</a> ;<br>
    }</p>

    <p>Because of Perl's portability, you could use this script on a Windows system as well as a
    Linux system -- it Just Works because of the underlying Perl interpreter code. In our
    create-an-account code above, that one is not portable, but is Linux-specific because it uses
    Linux commands such as adduser .</p>

    <p>In my experience, I've found it useful to have a Git repository of these things somewhere
    that I can clone on each new system I'm working with. Over time, you'll think of changes to
    make to the code to enhance the capabilities, or you'll add new scripts, and Git can help you
    make sure that all your tools and tricks are available on all your systems.</p>

    <p>I hope these little scripts have given you some ideas how you can use Perl to make your
    system administration life a little easier. In addition to these longer scripts, take a look at
    a fantastic list of <a target="_blank" href=
    "https://gist.github.com/mischapeters/1e8eef09a0aafd4f24f0">Perl one-liners, and links to other
    Perl magic</a> assembled by Mischa Peterson.</p>
 <!--TAGS: . ~/Admin2/Tips2 -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Admin/tips.shtml-->
<!--file:///f:/Public_html/Admin/index.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191108X_perl_tricks_for_system_administrators"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191022X_is_there_an_advantage_to_using_bash_over_perl_or_python" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191022X_larry_wall_approves_re_naming_perl_6_to_raku"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Oct 22, 2019] <a target="_blank" href="https://stackoverflow.com/questions/5858877/is-there-an-advantage-to-using-bash-over-perl-or-python">   Is there an advantage to using Bash over Perl or Python?</a></h4>

<blockquote>
<h6>Oct 22, 2019 |  <a target="_blank" href= "https://stackoverflow.com/questions/5858877/is-there-an-advantage-to-using-bash-over-perl-or-python"> stackoverflow.com</a></h6>
 

    <p><a target="_blank" href="https://stackoverflow.com/questions/ask">Ask Question</a> Asked 8
    years, 5 months ago Active <a target="_blank" href=
    "https://stackoverflow.com/questions/5858877/is-there-an-advantage-to-using-bash-over-perl-or-python?lastactivity">
    8 years, 5 months ago</a> Viewed 19k times 23 10</p>
    <hr noshade align="left" width="10" size="10">

    <p><b>></b> ,May 2, 2011 at 18:58</p>

    <blockquote>
      Hey I've been using Linux for a while and thought it was time to finally dive into shell
      scripting.

      <p>The problem is I've failed to find any significant advantage of using Bash over something
      like Perl or Python. Are there any performance or power differences between the two? I'd
      figure Python/Perl would be more well suited as far as power and efficiency goes.</p>
    </blockquote>

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/users/543411/sebastian">Sebastian</a></b> ,May 2, 2011 at 15:21</p>

    <blockquote>
      Two advantages come to mind:

      <ul>
        <li>Simplicity: direct access to all wonderful linux tools <code>wc</code> ,
        <code>ls</code> , <code>cat</code> , <code>grep</code> , <code>sed</code> ... etc. Why
        constantly use python's <code>subprocess</code> module?</li>

        <li>I'm increasingly fond of using <a target="_blank" href=
        "http://www.gnu.org/software/parallel/"><i>gnu parallel</i></a> , with which you can
        execute your bash scripts in parallel. E.g. from the man page, batch create thumbs of all
        jpgs in directory in parallel:

          <p><code>ls *.jpg | parallel convert -geometry 120 {} thumb_{}</code></p>
        </li>
      </ul>

      <p>By the way, I usually have some python calls in my bash scripts (e.g. for plotting). Use
      whatever is best for the task!</p>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/1421949/mario-peshev">Mario
    Peshev</a></b> ,May 2, 2011 at 15:16</p>

    <blockquote>
      Perl scripts are usually (if not 100% of the times) faster than bash.

      <p>A discussion on that: <a target="_blank" href=
      "https://stackoverflow.com/questions/1132135/is-perl-faster-than-bash">Perl vs Bash</a></p>
    </blockquote>

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/users/17945/reinierpost">reinierpost</a></b> ,May 7, 2011 at
    12:16</p>

    <blockquote>
      bash isn't a language so much as a command interpreter that's been hacked to death to allow
      for things that make it look like a scripting language. It's great for the simplest 1-5 line
      one-off tasks, but things that are dead simple in Perl or Python like array manipulation are
      horribly ugly in bash. I also find that bash tends not to pass two critical rules of thumb:

      <ol>
        <li>The 6-month rule, which says you should be able to easily discern the purpose and basic
        mechanics of a script you wrote but haven't looked at in 6 months.</li>

        <li>The 'WTF per minute' rule. Everyone has their limit, and mine is pretty small. Once I
        get to 3 WTFs/min, I'm looking elsewhere.</li>
      </ol>

      <p>As for 'shelling out' in scripting languages like Perl and Python, I find that I almost
      never need to do this, fwiw (disclaimer: I code almost 100% in Python). The Python os and
      shutil modules have most of what I need most of the time, and there are built-in modules for
      handling tarfiles, gzip files, zip files, etc. There's a glob module, an fnmatch module...
      there's a lot of stuff there. If you come across something you need to parallelize, then
      indent your code a level, put it in a 'run()' method, put that in a class that extends either
      threading.Thread or multiprocessing.Process, instantiate as many of those as you want,
      calling 'start()' on each one. Less than 5 minutes to get parallel execution generally.</p>

      <p>Best of luck. Hope this helps.</p>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/59135/daotoad">daotoad</a></b>
    ,May 2, 2011 at 17:40</p>

    <blockquote>
      For big projects use a language like Perl.

      <p>There are a few things you can only do in bash (for example, alter the calling environment
      (when a script is sourced rather than run). Also, shell scripting is commonplace. It is
      worthwhile to learn the basics and learn your way around the available docs.</p>

      <p>Plus there are times when knowing a shell well can save your bacon (on a fork-bombed
      system where you can't start any new processes, or if <code>/usr/bin</code> and or
      <code>/usr/local/bin</code> fail to mount).</p>
    </blockquote>

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/users/543411/sebastian">Sebastian</a></b> ,May 3, 2011 at 8:47</p>

    <blockquote>
      The advantage is that it's right there. Unless you use Python (or Perl) as your shell,
      writing a script to do a simple loop is a bunch of extra work.

      <p>For short, simple scripts that call other programs, I'll use Bash. If I want to keep the
      output, odds are good that I'll trade up to Python.</p>

      <p>For example:</p>
      <pre>
for file in *; do process $file ; done
</pre>

      <p>where <code>process</code> is a program I want to run on each file, or...</p>
      <pre>
while true; do program_with_a_tendency_to_fail ; done
</pre>

      <p>Doing either of those in Python or Perl is overkill.</p>

      <p>For actually writing a program that I expect to maintain and use over time, Bash is rarely
      the right tool for the job. Particularly since most modern Unices come with both Perl and
      Python.</p>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/471272/tchrist">tchrist</a></b>
    ,May 4, 2011 at 11:01</p>

    <blockquote>
      The most important advantage of POSIX shell scripts over Python or Perl scripts is that a
      POSIX shell is available on virtually every Unix machine. (There are also a few tasks shell
      scripts happen to be slightly more convenient for, but that's not a major issue.) If the
      portability is not an issue for you, I don't see much need to learn shell scripting.
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/471272/tchrist">tchrist</a></b>
    ,May 3, 2011 at 23:50</p>

    <blockquote>
      If you want to execute programs installed on the machine, nothing beats bash. You can always
      make a system call from Perl or Python, but I find it to be a hassle to read return values,
      etc.

      <p>And since you know it will work pretty much anywhere throughout all of of time...</p>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/13467/alexandr-ciornii">Alexandr
    Ciornii</a></b> ,May 3, 2011 at 8:26</p>

    <blockquote>
      The advantage of shell scripting is that it's globally present on *ix boxes, and has a
      relatively stable core set of features you can rely on to run everywhere. With Perl and
      Python you have to worry about whether they're available and if so what version, as there
      have been significant syntactical incompatibilities throughout their lifespans. (Especially
      if you include Python 3 and Perl 6.)

      <p>The disadvantage of shell scripting is everything else. Shell scripting languages are
      typically lacking in expressiveness, functionality and performance. And hacking command lines
      together from strings in a language without strong string processing features and libraries,
      to ensure the escaping is correct, invites security problems. Unless there's a compelling
      compatibility reason you need to go with shell, I would personally plump for a scripting
      language every time.</p>
    </blockquote>
    
 <!--TAGS: . ~/Scripting ~/Perl2 -->
 <!--file:///f:/Public_html/Scripting/index.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191022X_is_there_an_advantage_to_using_bash_over_perl_or_python"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191022X_larry_wall_approves_re_naming_perl_6_to_raku" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191021X_differences_between_perl_and_php_closed"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Oct 22, 2019] <a target="_blank" href="https://developers.slashdot.org/story/19/10/12/2134246/larry-wall-approves-re-naming-perl-6-to-raku">   Larry Wall Approves Re-Naming Perl 6 To Raku</a></h4>

<blockquote>
<h6>Oct 22, 2019 |  <a target="_blank" href= "https://developers.slashdot.org/story/19/10/12/2134246/larry-wall-approves-re-naming-perl-6-to-raku"> developers.slashdot.org</a></h6>
 

    <p><a target="_blank" href=
    "https://github.com/perl6/problem-solving/pull/89#pullrequestreview-300789072">(github.com)
    100</a>  <a target="_blank" href=
    "https://slashdot.org/~hondo77">hondo77</a> notes that Larry Wall has given his approval to the
    re-naming of Perl 6.</p>

    <p>In the "Path to Raku" pull request, Larry Wall indicated his approval, leaving this comment:
    <i>I am in favor of this change, because <a target="_blank" href=
    "https://github.com/perl6/problem-solving/pull/89#pullrequestreview-300789072">it reflects an
    ancient wisdom</a> :</i></p>

    <blockquote>
      <p><i>"No one sews a patch of unshrunk cloth on an old garment, for the patch will pull away
      from the garment, making the tear worse. Neither do people pour new wine into old wineskins.
      If they do, the skins will burst; the wine will run out and the wineskins will be ruined. No,
      they pour new wine into new wineskins, and both are preserved."</i></p>
    </blockquote>

    <p>"Perl 6 will become Raku, assuming the four people who haven't yet approved the pull request
    give their okay," reports the Register, adding that <a target="_blank" href=
    "https://www.theregister.co.uk/2019/10/11/perl_6_raku_larry_wall/">Perl 5 will then become
    simply Perl</a> .</p>

    <p>Dozens of comments on that pull request have now already been marked as "outdated," and
    while a few contributors have made a point of abstaining from the approval process, reviewer
    Alex Daniel <a target="_blank" href=
    "https://github.com/perl6/problem-solving/pull/89#issuecomment-540117093">notes</a> that "this
    pull request will be merged on October 14th if nobody in the list rejects it or requests more
    changes."</p>
 <!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191022X_larry_wall_approves_re_naming_perl_6_to_raku"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191021X_differences_between_perl_and_php_closed" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191013X_how_to_eliminate_a_value_in_the_middle_of_an_array_in_perl"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Oct 21, 2019] <a target="_blank" href="https://stackoverflow.com/questions/2534756/differences-between-perl-and-php">Differences  between Perl and PHP [closed]</a></h4>

<h5>Notable quotes:</h5>
<h5>"...  Perl has native regular expression support, ..."</h5>
<h5>"...  Perl has quite a few more  operators  , including           matching  ..."</h5>
<h5>"...  In PHP,   new   is an operator. In Perl, it's the conventional           name of an  object creation           subroutine  defined in packages, nothing special as far as the language is concerned. ..."</h5>
<h5>"...  Perl logical operators return their arguments, while they           return booleans  in PHP. ..."</h5>
<h5>"...  Perl gives access to the  symbol table  ..."</h5>
<h5>"...  Note that "references" has a different meaning in PHP and Perl. In PHP,           references  are symbol table aliases. In Perl,           references  are smart pointers. ..."</h5>
<h5>"...  Perl has different types for integer-indexed collections (arrays) and string indexed collections (hashes). In PHP,           they're the same type: an  associative array/ordered map   ..."</h5>
<h5>"...  Perl arrays aren't sparse ..."</h5>
<h5>"...  Perl supports hash and array  slices  natively, ..."</h5>
<blockquote>
<h6>Nov 23, 2013 |  <a target="_blank" href="https://stackoverflow.com/questions/2534756/differences-between-perl-and-php">stackoverflow.com</a></h6>
 
   <hr noshade align="left" width="10" size="10" />

   <p><b><a target="_blank" href="https://stackoverflow.com/users/150327/jholster">jholster</a></b> ,Nov 23, 2013 at 21:20</p>
   <blockquote>
      I'm planning to learn Perl 5 and as I have only used PHP until now, I wanted to know a bit about how the languages differ from 
      each other.

      <p>As PHP started out as a set of "Perl hacks" it has obviously cloned some of Perls features.</p>
      <ul>

         <li>What are the main differences in the syntax? Is it true that with Perl you have more options and ways to express something?</li>

         <li>Why is Perl not used for dynamic websites very often anymore? What made PHP gain more popularity?</li>
      </ul>
   </blockquote>

   <p><b><a target="_blank" href="https://stackoverflow.com/users/152948/hobbs">hobbs</a></b> ,Jan 17, 2013 at 8:36</p>
   <blockquote>
      Perl and PHP are more different than alike. Let's consider Perl 5, since Perl 6 is still under development. Some differences, 
      grouped roughly by subject:
      <ul>

         <li><em>Perl has native regular expression support,</em> including regexp literals. PHP uses Perl's regexp functions as an 
         extension.</li>

         <li><em>Perl has quite a few more <a target="_blank" href="http://perldoc.perl.org/perlop.html">operators</a> , including
         <a target="_blank" href="http://perldoc.perl.org/perlop.html#Binding-Operators">matching</a></em><a target="_blank" href="http://perldoc.perl.org/perlop.html#Binding-Operators"></a> 
         ( <code>=~</code> , <code>!~</code> ), <a target="_blank" href="http://perldoc.perl.org/perlop.html#Quote-Like-Operators">quote-like</a> 
         ( <code>qw</code> , <code>qx</code> &c.), <a target="_blank" href="http://perldoc.perl.org/perlop.html#Exponentiation">exponentiation</a> 
         ( <code>**</code> ), <a target="_blank" href="http://perldoc.perl.org/perlop.html#Multiplicative-Operators">string repetition</a> 
         ( <code>x</code> ) and <a target="_blank" href="http://perldoc.perl.org/perlop.html#Range-Operators">range</a> ( <code>..</code> 
         and <code>...</code> ). PHP has a few operators Perl doesn't, such as the
         <a target="_blank" href="http://us.php.net/manual/en/language.operators.errorcontrol.php">error suppression operator</a> (
         <code>@</code> ), <a target="_blank" href="http://php.net/instanceof"><code>instanceof</code></a> (though Perl does have the
         <code><a target="_blank" href="http://search.cpan.org/~dapm/perl-5.10.1/lib/UNIVERSAL.pm">Universal</a> ::isa</code> method) 
         and <a target="_blank" href="http://en.wikipedia.org/wiki/Sigil_(computer_programming)"><code>clone</code></a> .</li>

         <li><em>In PHP, <a target="_blank" href="http://php.net/new"><code>new</code></a> is an operator. In Perl, it's the conventional 
         name of an <a target="_blank" href="http://perldoc.perl.org/perltoot.html#Constructors-and-Instance-Methods">object creation 
         subroutine</a> defined in packages, nothing special as far as the language is concerned.</em></li>

         <li><em>Perl logical operators return their arguments, while they
         <a target="_blank" href="http://www.php.net/manual/en/language.operators.logical.php">return booleans</a> in PHP.</em> Try:

         <pre>
$foo = '' || 'bar';
</pre>

         <p>in each language. In Perl, you can even do <code>$foo ||= 'default'</code> to set $foo to a value if it's not already set. 
         The shortest way of doing this in PHP is <code>$foo = isset($foo) ? $foo : 'default';</code> (Update, in PHP 7.0+ you can do
         <code>$foo = $foo ?? 'default'</code> )</p>
         </li>

         <li>Perl <a target="_blank" href="http://perldoc.perl.org/perldata.html#Variable-names">variable names</a> indicate built-in 
         type, of which Perl has three, and the type specifier is part of the name (called a "
         <a target="_blank" href="http://en.wikipedia.org/wiki/Sigil_(computer_programming)">sigil</a> "), so <code>$foo</code> is a 
         different variable than <code>@foo</code> or <code>%foo</code> . (related to the previous point) Perl has separate
         <a target="_blank" href="http://www252.pair.com/comdog/mastering_perl/Chapters/08.symbol_tables.html">symbol table</a> entries 
         for scalars, arrays, hashes, code, file/directory handles and formats. Each has its own namespace.</li>

         <li><em>Perl gives access to the <a target="_blank" href="http://perldoc.perl.org/perlmod.html#Symbol-Tables">symbol table</a></em><a target="_blank" href="http://perldoc.perl.org/perlmod.html#Symbol-Tables"></a> 
         , though manipulating it isn't for the faint of heart. In PHP, symbol table manipulation is limited to creating
         <a target="_blank" href="http://php.net/references">references</a> and the <a target="_blank" href="http://php.net/extract">
         <code>extract</code></a> function.</li>

         <li><em>Note that "references" has a different meaning in PHP and Perl. In PHP,
         <a target="_blank" href="http://php.net/references">references</a> are symbol table aliases. In Perl,
         <a target="_blank" href="http://perldoc.perl.org/perlref.html">references</a> are smart pointers.</em></li>

         <li><em>Perl has different types for integer-indexed collections (arrays) and string indexed collections (hashes). In PHP, 
         they're the same type: an <a target="_blank" href="http://php.net/array">associative array/ordered map</a> </em>.</li>

         <li><em>Perl arrays aren't sparse</em>: setting an element with index larger than the current size of the array will set all 
         intervening elements to <code>undefined</code> (see <a target="_blank" href="http://perldoc.perl.org/perldata.html">perldata</a> 
         ). PHP arrays are sparse; setting an element won't set intervening elements.</li>

         <li><em>Perl supports hash and array <a target="_blank" href="http://perldoc.perl.org/perldata.html#Slices">slices</a> natively,</em> 
         and slices are assignable, which has all sorts of
         <a target="_blank" href="https://stackoverflow.com/questions/1242040/how-can-i-join-two-hashes-in-perl-without-using-a-loop/1242125#1242125">
         uses</a> . In PHP, you use <a target="_blank" href="http://php.net/array_slice"><code>array_slice</code></a> to extract a slice 
         and <a target="_blank" href="http://php.net/array_splice"><code>array_splice</code></a> to assign to a slice.</li>

         <li>You can leave out the
         <a target="_blank" href="http://php.net/manual/en/language.types.array.php#language.types.array.syntax.modifying">argument 
         to the subscript operator</a> in PHP for a bit of magic. In Perl, you can't leave out the subscript.</li>

         <li>Perl hashes are <a target="_blank" href="http://perldoc.perl.org/perlglossary.html#hash">unordered</a> .</li>

         <li>Perl has a large number of <a target="_blank" href="http://perldoc.perl.org/perlvar.html">predefined and magic variables</a> 
         . PHP's <a target="_blank" href="http://www.php.net/manual/en/language.variables.predefined.php">predefined variables</a> have 
         quite a different purpose.</li>

         <li>Perl has <a target="_blank" href="http://perldoc.perl.org/perlsyn.html#Statement-Modifiers">statement modifiers</a> : some 
         control statements can be placed at the end of a statement.</li>

         <li>Perl supports <a target="_blank" href="http://en.wikipedia.org/wiki/Scope_(programming)#Dynamic_scoping">dynamic scoping</a> 
         via the <code>local</code> keyword.</li>

         <li>In addition, Perl has global, lexical (block), and package
         <a target="_blank" href="http://docstore.mik.ua/orelly/perl/prog3/ch04_08.htm">scope</a> . PHP has global, function, object, 
         class and namespace <a target="_blank" href="http://php.net/manual/en/language.variables.scope.php">scope</a> .</li>

         <li>In Perl, variables are global by default. In PHP, variables in functions are local by default.</li>

         <li>Perl supports explicit <a target="_blank" href="http://en.wikipedia.org/wiki/Tail_call">tail calls</a> via the
         <a target="_blank" href="http://perldoc.perl.org/functions/goto.html"><code>goto</code></a> function.</li>

         <li>Perl's <a target="_blank" href="http://perldoc.perl.org/perlsub.html#Prototypes">prototypes</a> provide more limited type 
         checking for function arguments than PHP's <a target="_blank" href="http://php.net/manual/en/language.oop5.typehinting.php">
         type hinting</a> . As a result, prototypes are of more limited utility than type hinting.</li>

         <li>In Perl, the last evaluated statement is returned as the value of a subroutine if the statement is an expression (i.e. 
         it has a value), even if a return statement isn't used. If the last statement isn't an expression (i.e. doesn't have a value), 
         such as a loop, the return value is unspecified (see <a target="_blank" href="http://perldoc.perl.org/perlsub.html">perlsub</a> 
         ). In PHP, if there's no explicit return, the
         <a target="_blank" href="http://www.php.net/manual/en/functions.returning-values.php">return value is NULL</a> .</li>

         <li>Perl flattens lists (see <a target="_blank" href="http://perldoc.perl.org/perlsub.html">perlsub</a> ); for un-flattened 
         data structures, use references.

         <pre>
@foo = qw(bar baz);
@qux = ('qux', @foo, 'quux'); # @qux is an array containing 4 strings
@bam = ('bug-AWWK!', \@foo, 'fum'); # @bam contains 3 elements: two strings and a array ref
</pre>

         <p>PHP doesn't flatten arrays.</p>
         </li>

         <li>Perl has <a target="_blank" href="http://perldoc.perl.org/perlmod.html#BEGIN%2c-UNITCHECK%2c-CHECK%2c-INIT-and-END">special 
         code blocks</a> ( <code>BEGIN</code> , <code>UNITCHECK</code> , <code>CHECK</code> , <code>INIT</code> and <code>END</code> 
         ) that are executed. Unlike PHP's <a target="_blank" href="http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file">
         <code>auto_prepend_file</code></a> and
         <a target="_blank" href="http://www.php.net/manual/en/ini.core.php#ini.auto-append-file"><code>auto_append_file</code></a> 
         , there is no limit to the number of each type of code block. Also, the code blocks are defined within the scripts, whereas 
         the PHP options are set in the server and per-directory config files.</li>

         <li>In Perl, the semicolon <a target="_blank" href="http://perldoc.perl.org/perlsyn.html#Simple-Statements">separates statements</a> 
         . In PHP, it <a target="_blank" href="http://www.php.net/manual/en/language.basic-syntax.instruction-separation.php">terminates</a> 
         them, excepting that a PHP close tag ("?>") can also terminate a statement.</li>

         <li>The value of expressions in Perl is <a target="_blank" href="http://perldoc.perl.org/perldata.html#Context">context sensitive</a> 
         .</li>

         <li>Negative subscripts in Perl are relative to the end of the array. <code>$bam[-1]</code> is the final element of the array. 
         Negative subscripts in PHP are subscripts like any other.</li>

         <li>In Perl 5, classes are based on packages and look nothing like classes in PHP (or most other languages). Perl 6 classes 
         are closer to PHP classes, but still quite different. (Perl 6 is
         <a target="_blank" href="http://perlcabal.org/syn/Differences.html">different</a> from Perl 5 in many other ways, but that's 
         off topic.) Many of the differences between Perl 5 and PHP arise from the fact that most of the OO features are not built-in 
         to Perl but based on hacks. For example, <code>$obj->method(@args)</code> gets translated to something like <code>(ref $obj)::method($obj, 
         @args)</code> . Non-exhaustive list:
         <ul>

            <li>PHP automatically provides the special variable <code>$this</code> in methods. Perl passes a reference to the object 
            as the first argument to methods.</li>

            <li>Perl requires references to be <a target="_blank" href="http://perldoc.perl.org/functions/bless.html">blessed</a> to 
            create an object. Any reference can be blessed as an instance of a given class.</li>

            <li>In Perl, you can dynamically change inheritance via the packages <code>@ISA</code> variable.</li>
         </ul>
         </li>

         <li>Perl supports <a target="_blank" href="http://perldoc.perl.org/overload.html">operator overloading</a> .</li>

         <li>Strictly speaking, Perl doesn't have multiline comments, but the
         <a target="_blank" href="http://perldoc.perl.org/perlpod.html">POD</a> system can be used for the same affect.</li>

         <li>In Perl, <code>//</code> is an operator. In PHP, it's the start of a one-line comment.</li>

         <li>Until PHP 5.3, PHP had terrible support for anonymous functions (the <code>create_function</code> function) and no support 
         for closures.</li>

         <li>PHP had nothing like Perl's packages until version 5.3, which introduced
         <a target="_blank" href="http://www.php.net/manual/en/language.namespaces.php">namespaces</a> .</li>

         <li>Arguably, Perl's built-in support for exceptions looks almost nothing like exceptions in other languages, so much so that 
         they scarcely seem like exceptions. You evaluate a block and check the value of <code>$@</code> ( <code>eval</code> instead 
         of <code>try</code> , <a target="_blank" href="http://perldoc.perl.org/functions/die.html"><code>die</code></a> instead of
         <code>throw</code> ). The <a target="_blank" href="http://search.cpan.org/~shlomif/Error-0.17016/lib/Error.pm"><s>Error</s></a>
         <a target="_blank" href="http://p3rl.org/Try::Tiny">Try::Tiny</a> module supports exceptions as you find them in other languages 
         (as well as some other modules listed in <a target="_blank" href="https://metacpan.org/module/Error#SEE-ALSO">Error's See Also</a> 
         section).</li>
      </ul>

      <p>PHP was inspired by Perl the same way <i>Phantom of the Paradise</i> was inspired by <i>Phantom of the Opera</i> , or <i>Strange 
      Brew</i> was inspired by <i>Hamlet</i> . It's best to put the behavior specifics of PHP out of your mind when learning Perl, else 
      you'll get tripped up.</p>

      <p>My brain hurts now, so I'm going to stop.</p>
   </blockquote>

   <p><b><a target="_blank" href="https://stackoverflow.com/users/285587/your-common-sense">Your Common Sense</a></b> ,Mar 29, 2010 
   at 2:19</p>
   <blockquote>
      When PHP came to the scene, everyone were impressed with main differences from Perl:
      <ol>

         <li>Input variables already in the global scope, no boring parsing.</li>

         <li>HTML embedding. Just <code><?php ... ?></code> anywhere. No boring templates.</li>

         <li>On-screen error messages. No boring error log peeks.</li>

         <li>Easy to learn. No boring book reading.</li>
      </ol>

      <p>As the time passed, everyone learned that they were not a benefit, hehe...</p>
   </blockquote>

   <p><b><a target="_blank" href="https://stackoverflow.com/users/19068/quentin">Quentin</a></b> ,Jan 15, 2016 at 3:27</p>
   <blockquote>
      I've noticed that most PHP vs. Perl pages seem to be of the
      <blockquote>

         <p>PHP is better than Perl because <insert lame reason here></p>
      </blockquote>

      <p>ilk, and rarely make reasonable comparisons.</p>

      <p>Syntax-wise, you will find PHP is often easier to understand than Perl, particularly when you have little experience. For example, 
      trimming a string of leading and trailing whitespace in PHP is simply</p>

      <pre>
$string = trim($string);</pre>

      <p>In Perl it is the somewhat more cryptic</p>

      <pre>
$string =~ s/^\s+//;
$string =~ s/\s+$//;</pre>

      <p>(I believe this is slightly more efficient than a single line capture and replace, and also a little more understandable.) 
      However, even though PHP is often more English-like, it sometimes still shows its roots as a wrapper for low level C, for example,
      <code>strpbrk</code> and <code>strspn</code> are probably rarely used, because most PHP dabblers write their own equivalent functions 
      for anything too esoteric, rather than spending time exploring the manual. I also wonder about programmers for whom English is 
      a second language, as everybody is on equal footing with things such as Perl, having to learn it from scratch.</p>

      <p>I have already mentioned the manual. PHP has a fine online manual, and unfortunately it needs it. I still refer to it from 
      time to time for things that should be simple, such as order of parameters or function naming convention. With Perl, you will 
      probably find you are referring to the manual a lot as you get started and then one day you will have an <i>a-ha</i> moment and 
      never need it again. Well, at least not until you're more advanced and realize that not only is there more than one way, there 
      is probably a better way, somebody else has probably already done it that better way, and perhaps you should just visit CPAN.</p>

      <p>Perl does have a lot more options and ways to express things. This is not necessarily a good thing, although it allows code 
      to be more readable if used wisely and at least one of the ways you are likely to be familiar with. There are certain styles and 
      idioms that you will find yourself falling into, and I can heartily recommend reading
      <a target="_blank" href="https://rads.stackoverflow.com/amzn/click/com/0596001738">Perl Best Practices</a> (sooner rather than 
      later), along with <a target="_blank" href="https://rads.stackoverflow.com/amzn/click/com/0596003137">Perl Cookbook, Second Edition</a> 
      to get up to speed on solving common problems.</p>

      <p>I believe the reason Perl is used less often in shared hosting environments is that historically the perceived slowness of 
      CGI and hosts' unwillingness to install <a target="_blank" href="http://en.wikipedia.org/wiki/Mod_perl">mod_perl</a> due to security 
      and configuration issues has made PHP a more attractive option. The cycle then continued, more people learned to use PHP because 
      more hosts offered it, and more hosts offered it because that's what people wanted to use. The speed differences and security 
      issues are rendered moot by <a target="_blank" href="http://en.wikipedia.org/wiki/FastCGI">FastCGI</a> these days, and in most 
      cases PHP is run out of FastCGI as well, rather than leaving it in the core of the web server.</p>

      <p>Whether or not this is the case or there are other reasons, PHP became popular and a myriad of applications have been written 
      in it. For the majority of people who just want an entry-level website with a simple blog or photo gallery, PHP is all they need 
      so that's what the hosts promote. There should be nothing stopping you from using Perl (or anything else you choose) if you want.</p>

      <p>At an enterprise level, I doubt you would find too much PHP in production (and please, no-one point at <i>Facebook</i> as a 
      counter-example, I said <i>enterprise</i> level).</p>
   </blockquote>

   <p><b><a target="_blank" href="https://stackoverflow.com/users/4727/leon-timmermans">Leon Timmermans</a></b> ,Mar 28, 2010 at 22:15</p>
   <blockquote>
      Perl is used plenty for websites, no less than Python and Ruby for example. That said, PHP is used way more often than any of 
      those. I think the most important factors in that are PHP's ease of deployment and the ease to start with it.

      <p>The differences in syntax are too many to sum up here, but generally it is true that it has more ways to express yourself (this 
      is know as TIMTWOTDI, There Is More Than One Way To Do It).</p>
   </blockquote>

   <p><b><a target="_blank" href="https://stackoverflow.com/users/1337/brad-gilbert">Brad Gilbert</a></b> ,Mar 29, 2010 at 4:04</p>
   <blockquote>
      My favorite thing about Perl is the way it handles arrays/lists. Here's an example of how you would make and use a Perl function 
      (or "subroutine"), which makes use of this for arguments:

      <pre>
sub multiply
{
    my ($arg1, $arg2) = @_; # @_ is the array of arguments
    return $arg1 * $arg2;
}
</pre>

      <p>In PHP you could do a similar thing with <code>list()</code> , but it's not quite the same; in Perl lists and arrays are actually 
      treated the same (usually). You can also do things like:</p>

      <pre>
$week_day_name = ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")[$week_day_index];
</pre>

      <p>And another difference that you MUST know about, is numerical/string comparison operators. In Perl, if you use <code><</code> 
      , <code>></code> , <code>==</code> , <code>!=</code> , <code><=></code> , and so on, Perl converts both operands to numbers. If 
      you want to convert as strings instead, you have to use <code>lt</code> , <code>gt</code> , <code>eq</code> , <code>ne</code> 
      , <code>cmp</code> (the respective equivalents of the operators listed previously). Examples where this will really get you:</p>

      <pre>
if ("a" == "b") { ... } # This is true.
if ("a" == 0) { ... } # This is also true, for the same reason.
</pre>
   </blockquote>

   <p><b><a target="_blank" href="https://stackoverflow.com/users/271104/sorin-postelnicu">Sorin Postelnicu</a></b>, Aug 5, 2015 at 
   15:44</p>
   <blockquote>
      I do not need add anything to outis's fantastic answer, i want only show the answer for you question:
      <blockquote>

         <p>Why is Perl not used for dynamic websites very often anymore? What made PHP gain more popularity than it?</p>
      </blockquote>

      <p>Please check first some "Job Trends" sites - and you can make the judgement alone.</p>
      <ul>

         <li><a target="_blank" href="http://www.indeed.com/jobtrends?q=perl,%20ruby,%20python,%20php">http://www.indeed.com/jobtrends?q=perl,%20ruby,%20python,%20php</a></li>
      </ul>

      <p>as you can see, perl is still a leader - but preferable for real applications not for toys. :)</p>
   </blockquote>
   <!--TAGS: . ~/Scripting ~/Perl2 /php. -->

<!--file:///f:/Public_html/Scripting/php.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
</blockquote>


</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191021X_differences_between_perl_and_php_closed"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191013X_how_to_eliminate_a_value_in_the_middle_of_an_array_in_perl" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191013X_what_are_donald_knuth_s_main_original_contributions_to_computer_science_quora"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Oct 13, 2019] <a target="_blank" href="https://perlmaven.com/how-to-eliminate-a-value-in-the-middle-of-an-array-in-perl">How to   eliminate a value in the middle of an array in Perl</a> by Gabor Szabo</h4>

<h5>Gabor Szabo is an expert in Perl who originally wrote Padre Perl Padre <a target="_blank" href="http://padre.perlide.org">http://padre.perlide.org</a> (abandonware since 2013). The last
  that was available was Ubuntu 10.10.</h5>
<h5>Notable quotes:</h5>
<h5>"...  This code will set element 3 (the 4th element of the array) to undef , but will  NOT      change the size of the array: ..."</h5>
<blockquote>
<h6>Oct 13, 2019 |  <a target="_blank" href= "https://perlmaven.com/how-to-eliminate-a-value-in-the-middle-of-an-array-in-perl">perlmaven.com</a></h6>
 
 

    <ul>
      <li><a target="_blank" href="https://perlmaven.com/search/undef">undef</a></li>

      <li><a target="_blank" href="https://perlmaven.com/search/splice">splice</a></li>

      <li><a target="_blank" href="https://perlmaven.com/search/array">array</a></li>

      <li><a target="_blank" href="https://perlmaven.com/search/delete">delete</a></li>
    </ul>In response to an earlier article about <a target="_blank" href=
    "https://perlmaven.com/undef-and-defined-in-perl">undef</a> one of the readers asked me:

    <p>How do you eliminate a value in the middle of an array in Perl?</p>

    <p>I am not sure if undef and eliminating values from an array are related, though I guess, if
    we see having a value of undef as being "empty", then I can understand the connection. In
    general though, setting something to be undef and deleting something is not the same.</p>

    <p>Are you serious about Perl? Check out my <a target="_blank" href=
    "https://leanpub.com/perl-maven">Beginner Perl Maven book</a> .<br>
    I have written it for you!</p>

    <p>Let's see first how we can set an element of an array to be undef and then how we can delete
    an element from an array.</p>

    <p>We start with the following code:</p>

    <ol>
      <li>use Data :: Dumper qw ( Dumper );</li>

      <li>my @dwarfs = qw ( Doc Grumpy Happy Sleepy Sneezy Dopey Bashful );</li>

      <li>print Dumper \@dwarfs ;</li>
    </ol>

    <p>When printed using Data::Dumper we get the following output:</p>
    <pre>
$VAR1 = [
          'Doc',
          'Grumpy',
          'Happy',
          'Sleepy',
          'Sneezy',
          'Dopey',
          'Bashful'
        ];
</pre><b>Set an element to undef</b>

    <p>Using the return value of the undef() function:</p>

    <ol>
      <li>use Data :: Dumper qw ( Dumper );</li>

      <li>my @dwarfs = qw ( Doc Grumpy Happy Sleepy Sneezy Dopey Bashful );</li>

      <li>$dwarfs [ 3 ] = undef ;</li>

      <li>print Dumper \@dwarfs ;</li>
    </ol>

    <p><em>This code will set element 3 (the 4th element of the array) to undef , but will <b>NOT</b>
    change the size of the array:</em></p>
    <pre>
$VAR1 = [
          'Doc',
          'Grumpy',
          'Happy',
          undef,
          'Sneezy',
          'Dopey',
          'Bashful'
        ];
</pre>

    <p>Using the undef() function directly on an element of an array yields similar results:</p>

    <ol>
      <li>use Data :: Dumper qw ( Dumper );</li>

      <li>my @dwarfs = qw ( Doc Grumpy Happy Sleepy Sneezy Dopey Bashful );</li>

      <li>undef $dwarfs [ 3 ];</li>

      <li>print Dumper \@dwarfs ;</li>
    </ol>

    <p>So for our purposes <tt>$dwarfs[3] = undef</tt>; and <tt>undef $dwarfs[3]</tt>; do the same thing. They both
    can set a value to be undef .</p><b>Removing an element from the array using splice</b>

    <p>The splice function can totally eliminate the value from the array:</p>

    <ol>
      <li>use Data :: Dumper qw ( Dumper );</li>

      <li>my @dwarfs = qw ( Doc Grumpy Happy Sleepy Sneezy Dopey Bashful );</li>

      <li><tt>splice @dwarfs,3,1;</tt></li>

      <li>print Dumper \@dwarfs ;</li>
    </ol>
    <pre>
$VAR1 = [
          'Doc',
          'Grumpy',
          'Happy',
          'Sneezy',
          'Dopey',
          'Bashful'
        ];
</pre>

    <p>As you can see, in this case the array became one element shorter as we have <b>removed one
    of the elements</b> from the middle of the array.</p>

    <p>This is how you can <b>delete an element from an array</b> .</p>
 <!--TAGS: .  -->

<!--file:///f:/Public_html/Scripting/Perlorama/Variables/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191013X_how_to_eliminate_a_value_in_the_middle_of_an_array_in_perl"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191013X_what_are_donald_knuth_s_main_original_contributions_to_computer_science_quora" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191013X_7_of_the_most_useful_perl_command_line_options"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Oct 13, 2019] <a target="_blank" href="https://www.quora.com/What-are-Donald-Knuths-main-original-contributions-to-computer-science">What   are Donald Knuth's main original contributions to computer science - Quora</a></h4>

<blockquote>
<h6>Oct 13, 2019 |  <a target="_blank" href= "https://www.quora.com/What-are-Donald-Knuths-main-original-contributions-to-computer-science">www.quora.com</a></h6>
 
    <hr noshade align="left" width="10" size="10">

    <p><a target="_blank" href="https://www.quora.com/profile/Radu-Grigore">Radu Grigore</a> ,
    argued rigor <a target="_blank" href=
    "https://www.quora.com/What-are-Donald-Knuths-main-original-contributions-to-computer-science/answer/Radu-Grigore">
    Answered Apr 22 2012</a> I think some of the main original contributions to Computer Science
    are the following:<br></p>

    <ul>
      <li>Knuth-Bendix algorithm/orders, used in all modern theorem provers, such as Z3 and
      Vampire, which in turn are used by many program analysis tools. The article is <i>Simple Word
      Problems in Universal Algebras</i> .</li>

      <li>Knuth-Moris-Pratt string searching (already mentioned). The article is <i>Fast Pattern
      Matching in Strings</i> .</li>

      <li>LR(k) grammars, which lay the foundation for parser generators (think yacc and
      successors). The article is <i>On the Translation of Languages from Left to Right</i> .</li>

      <li>Attribute grammars, a way to define the semantics of a (simple) programming language that
      pops up in research every now and then. For example, they were used in the study of VLSI
      circuits. The article is <i>Semantics of Context-Free Languages</i> .</li>

      <li>I believe he was the first to profile programs. The article is <i>An Empirical Study of
      FORTRAN Programs</i> .</li>
    </ul>He also did some work in mathematics. If I remember correctly, I saw him in a video saying
    that the article he is most proud of is <i>The Birth of the Giant Component</i> . <a target=
    "_blank" href="https://www.quora.com/profile/Mark-VandeWettering">Mark VandeWettering</a> , I
    have a lab coat, trust me! <a target="_blank" href=
    "https://www.quora.com/What-are-Donald-Knuths-main-original-contributions-to-computer-science/answer/Mark-VandeWettering">
    Answered Jan 10, 2014</a> · Author has 7.2k answers and 23.3m answer views Knuth won the
    Turing Award in 1974 for his contributions to the analysis of algorithms I'd submit that his
    "expository" work in the form of The Art of Programming go well beyond simple exposition, and
    brought a rigor and precision to the analysis of algorithms which was (and probably still is)
    unparalleled in term of thoroughness and scope. There is more knowledge in the margins of The
    Art of Programming than there is in most programming courses. 1.2k views · <a target=
    "_blank" href=
    "https://www.quora.com/What-are-Donald-Knuths-main-original-contributions-to-computer-science#">
    View 7 Upvoters <img alt="Eugene Miya" src=
    "https://qph.fs.quoracdn.net/main-thumb-1608724-100-9ngQoQptENYQkLkWOH7W0knxINylQl2B.jpeg"></a>
    <a target="_blank" href="https://www.quora.com/profile/Eugene-Miya">Eugene Miya</a> ,
    Ex-Journal Editor, parallelism DB, committees and conferences, etc. <a target="_blank" href=
    "https://www.quora.com/What-are-Donald-Knuths-main-original-contributions-to-computer-science/answer/Eugene-Miya">
    Answered Sep 9, 2014</a> · Author has 11.2k answers and 7.9m answer views Everyone cites
    and overcites TAOCP.

    <p>Start collecting <i>Selected Papers (in|on)</i> ... He has 8 volumes. If you need the titles
    consider Amazon: <a target="_blank" href="http://amazon.com/">Online Shopping for Electronics,
    Apparel, Computers, Books, DVDs & more</a> or Barnes &Noble: <a target="_blank" href=
    "http://bn.com/">Books, Textbooks, eBooks, Toys, Games & More</a> for their ToC.</p>
    
 <!--TAGS: . ~/Perl -->
 <!--file:///f:/Public_html/Bookshelf/Computers/Classics/taocp.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/classic_computer_books.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191013X_what_are_donald_knuth_s_main_original_contributions_to_computer_science_quora"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191013X_7_of_the_most_useful_perl_command_line_options" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191009X_static_and_state_variables_in_perl"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Oct 13, 2019] <a target="_blank" href="https://perlmaven.com/perl-command-line-options">7 of   the most useful Perl command line options</a> by Gabor Szabo</h4>

<blockquote>
<h6>Oct 13, 2019 |  <a target="_blank" href= "https://perlmaven.com/perl-command-line-options">perlmaven.com</a></h6>
 

    <p><b>-e execute code on the command line</b></p>

    <p>For one-off tasks it can be very useful to be able to run a piece of Perl code without
    creating a file. The code itself needs to be between quotes. Due to differences between the
    Unix/Linux shell and the MS Windows Command prompt we need to use different quotes around our
    code.</p>

    <p>On Unix/Linux systsem (including Mac OSX) it is recommended to put our code in single quotes
    as in the following example:</p>
    <pre>
$ perl -e 'print qq{Hello World\n}'

Hello World
</pre>

    <p>On MS Windows we must use double quotes around our code.</p>
    <pre>
$ perl -e "print qq{Hello World\n}"

Hello World
</pre>

    <p>Internally, it is probably the best to use <a target="_blank" href=
    "https://perlmaven.com/quoted-interpolated-and-escaped-strings-in-perl">q and qq</a> instead of
    single-quote and double-quote, respectively. That might help reduce the confusion caused by the
    behavior of the shell and command prompt.</p><b>-E execute code on the command line with all
    the latest features enabled</b>

    <p>Since version 5.10 of Perl has been released, Perl includes some additional keywords (called
    features) in the language. For improved backward compatibility these keywords are only enabled
    if the user explicitly ask for them with use feature ... . For example by writing use feature
    qw(say); , or by declaring a minimal version of Perl with use 5.010; .</p>

    <p>On the command line we can achieve the same by using -E instead of -e . It will turn on all
    the features of the version of Perl we are currently running.</p>

    <p>For me the most important of all these features, at least in one-liners is the <a target=
    "_blank" href="https://perlmaven.com/what-is-new-in-perl-5.10--say-defined-or-state">say
    keyword introduced in perl 5.10</a> . It is just print with a trailing newline added. Nothing
    fancy, but makes the one-liners even shorter.</p>

    <p>The above examples would look like these:</p>

    <p>Unix/Linux:</p>
    <pre>
$ perl -E 'say q{Hello World}'

Hello World
</pre>

    <p>MS Windows:</p>
    <pre>
$ perl -E "say q{Hello World}"

Hello World
</pre>

    <p>You can notice the change from qq to q . As we don't need to include a newline \n in our
    strings we could switch from <a target="_blank" href=
    "https://perlmaven.com/quoted-interpolated-and-escaped-strings-in-perl">qq to q</a> .</p><b>-n
    wrap the -e/-E code in a while loop</b>

    <p>If we provide the -n command line option it will wrap our code provided using either the -e
    or the -E options in a while with a <a target="_blank" href=
    "https://perlmaven.com/the-diamond-operator">diamond operator</a> .</p>

    <p>So</p>
    <pre>
perl -n -E 'say if /code/' file.txt
</pre>

    <p>is the same as</p>
    <pre>
while (<>) {
    say if /code/;
}
</pre>

    <p>That will go over all the lines of all the files provided on the command line (in this case
    it is file.txt) and print out every line that matches the /code/ regex.</p><b>-p is like -n
    with print $_</b>

    <p>The -p option is very similar to the -n flag, but it also prints the content of $_ at the
    end of each iteration.</p>

    <p>So we could write:</p>
    <pre>
perl -p -E 's/code/foobar/' file.txt
</pre>

    <p>which would become</p>
    <pre>
while (<>) {
    s/code/foobar/
    print;
}
</pre>

    <p>That will print the result to the screen.</p><b>-i for in-place editing</b>

    <p>The most common use of -p is together with the -i option that provides "in-place editing".
    It means that instead of printing to the screen, all the output generated by our one-liner will
    be written back to the same file it was taken from.</p>

    <p>So this one-liner will replace the first appearance of the string "code" by "foobar" in
    every line of the file "file.txt".</p>
    <pre>
perl -i -p -E 's/code/foobar/' file.txt
</pre>
 <!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191013X_7_of_the_most_useful_perl_command_line_options"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191009X_static_and_state_variables_in_perl" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191009X_use_vars_vs_ours"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Oct 09, 2019] <a target="_blank" href="https://perlmaven.com/static-and-state-variables-in-perl">Static and state variables in   Perl</a></h4>

<blockquote>
<h6>Oct 09, 2019 |  <a target="_blank" href= "https://perlmaven.com/static-and-state-variables-in-perl">perlmaven.com</a></h6>
 
 

    <p><ins data-ad-slot="2003827732" data-ad-client="ca-pub-7760157643054954"></ins></p>

    <ul>
      <li><a target="_blank" href="https://perlmaven.com/search/static">static</a></li>

      <li><a target="_blank" href="https://perlmaven.com/search/state">state</a></li>
    </ul><b><a target="_blank" href="https://perlmaven.com/array-references-in-perl">Prev
    Next</a></b> In most of the cases we either want a variable to be accessible only from inside a
    small scope, inside a function or even inside a loop. These variables get created when we enter
    the function (or the scope created by a a block) and destroyed when we leave the scope.

    <p>In some cases, especially when we don't want to pay attention to our code, we want variables
    to be global, to be accessible from anywhere in our script and be destroyed only when the
    script ends. In General having such global variables is not a good practice.</p>

    <p>In some cases we want a variable to stay alive between function calls, but still to be
    private to that function. We want it to retain its value between calls.</p>

    <p>Are you serious about Perl? Check out my <a target="_blank" href=
    "https://leanpub.com/perl-maven">Beginner Perl Maven book</a> .<br>
    I have written it for you!</p>

    <p>In the C programming language one can designate a variable to be a <a target="_blank" href=
    "http://en.wikipedia.org/wiki/Static_variable">static variable</a> . This means it gets
    initialized only once and it sticks around retaining its old value between function calls.</p>

    <p>In Perl, the same can be achieved using the <a target="_blank" href=
    "https://perlmaven.com/what-is-new-in-perl-5.10--say-defined-or-state">state variable</a> which
    is available starting from version 5.10, but there is a construct that will work in every
    version of Perl 5. In a way it is even more powerful.</p>

    <p>Let's create a counter as an example:</p><b>state variable</b>

    <ol>
      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use 5.010 ;</li>

      <li>sub count {</li>

      <li>state $counter = 0 ;</li>

      <li>$counter ++;</li>

      <li>return $counter ;</li>

      <li>}</li>

      <li>say count ();</li>

      <li>say count ();</li>

      <li>say count ();</li>

      <li>#say $counter;</li>
    </ol>

    <p>In this example, instead of using <a target="_blank" href=
    "https://perlmaven.com/variable-declaration-in-perl">my to declare the internal variable</a> ,
    we used the state keyword.</p><a target="_blank" href=
    "https://leanpub.com/perl-maven/"><img src=
    "https://perlmaven.com/img/perl-maven-book-cover-306x396.png"></a> $counter is initialized to 0
    only once, the first time we call counter() . In subsequent calls, the line state $counter = 0;
    does not get executed and $counter has the same value as it had when we left the function the
    last time.

    <p>Thus the output will be:</p>
    <pre>
1
2
3
</pre>

    <p>If we removed the # from last line, it would generate a <a target="_blank" href=
    "https://perlmaven.com/global-symbol-requires-explicit-package-name">Global symbol "$counter"
    requires explicit package name at ... line ...</a> error when trying to compile the script.
    This just shows that the variable $counter is not accessible outside the function.</p><b>state
    is executed in the first call</b>

    <p>Check out this strange example:</p>

    <ol>
      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use 5.010 ;</li>

      <li>sub count {</li>

      <li>state $counter = say "world" ;</li>

      <li>$counter ++;</li>

      <li>return $counter ;</li>

      <li>}</li>

      <li>say "hello" ;</li>

      <li>say count ();</li>

      <li>say count ();</li>

      <li>say count ();</li>
    </ol>

    <p>This will print out</p>
    <pre>
hello
world
2
3
4
</pre>

    <p>showing that the state $counter = say "world"; line only gets executed once. In the first
    call to count() say , which was also <a target="_blank" href=
    "https://perlmaven.com/what-is-new-in-perl-5.10--say-defined-or-state">added in version
    5.10</a> , will return 1 upon success.</p><b>static variables in the "traditional" way</b>

    <ol>
      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use 5.010 ;</li>

      <li>{</li>

      <li>my $counter = 0 ;</li>

      <li>sub count {</li>

      <li>$counter ++;</li>

      <li>return $counter ;</li>

      <li>}</li>

      <li>}</li>

      <li>say count ();</li>

      <li>say count ();</li>

      <li>say count ();</li>
    </ol>

    <p>This provides the same result as the above version using state , except that this could work
    in older versions of perl as well. (Especially if I did not want to use the say keyword, that
    was also introduced in 5.10.)</p>

    <p>This version works because functions declarations are global in perl - so count() is
    accessible in the main body of the script even though it was declared inside a block. On the
    other hand the variable $counter is not accessible from the outside world because it was
    declared inside the block. Lastly, but probably most importantly, it does not get destroyed
    when we leave the count() function (or when the execution is outside the block), because the
    existing count() function still references it.</p>

    <p>Thus $count is effectively a static variable.</p><b>First assignment time</b>

    <ol>
      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use 5.010 ;</li>

      <li>say "hi" ;</li>

      <li>{</li>

      <li>my $counter = say "world" ;</li>

      <li>sub count {</li>

      <li>$counter ++;</li>

      <li>return $counter ;</li>

      <li>}</li>

      <li>}</li>

      <li>say "hello" ;</li>

      <li>say count ();</li>

      <li>say count ();</li>

      <li>say count ();</li>
    </ol>
    <pre>
hi
world
hello
2
3
4
</pre>

    <p>This shows that in this case too, the declaration and the initial assignment my $counter =
    say "world"; happens only once, but we can also see that the assignment happens <b>before</b>
    the first call to count() as if the my $counter = say "world"; statement was part of the
    control flow of the code <b>outside</b> of the block.</p><b>Shared static variable</b>

    <p>This "traditional" or "home made" static variable has an extra feature. Because it does not
    belong to the the count() subroutine, but to the block surrounding it, we can declare more than
    one functions in that block and we can share this static variable between two or even more
    functions.</p>

    <p>For example we could add a reset_counter() function:</p>

    <ol>
      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use 5.010 ;</li>

      <li>{</li>

      <li>my $counter = 0 ;</li>

      <li>sub count {</li>

      <li>$counter ++;</li>

      <li>return $counter ;</li>

      <li>}</li>

      <li>sub reset_counter {</li>

      <li>$counter = 0 ;</li>

      <li>}</li>

      <li>}</li>

      <li>say count ();</li>

      <li>say count ();</li>

      <li>say count ();</li>

      <li>reset_counter ();</li>

      <li>say count ();</li>

      <li>say count ();</li>
    </ol>
    <pre>
1
2
3
1
2
</pre>

    <p>Now both functions can access the $counter variable, but still nothing outside the enclosing
    block can access it.</p><b>Static arrays and hashes</b>

    <p>As of now, you cannot use the state declaration in list context. This means you cannot write
    state @y = (1, 1); . This limitation could be overcome by some extra coding. For example in
    this implementation of the Fibonacci series, we checked if the array is empty and set the
    default values:</p>

    <ol>
      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use 5.010 ;</li>

      <li>sub fib {</li>

      <li>state @y ;</li>

      <li>@y = ( 1 , 1 ) if not @y ; # workaround initialization</li>

      <li>push @y , $y [ 0 ]+ $y [ 1 ];</li>

      <li>return shift @y ;</li>

      <li>}</li>

      <li>say fib ();</li>

      <li>say fib ();</li>

      <li>say fib ();</li>

      <li>say fib ();</li>

      <li>say fib ();</li>
    </ol>

    <p>Alternatively we could use the "old-style" static variable with the enclosing block.</p>

    <p>Here is the example generating the Fibonacci series:</p>

    <ol>
      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use 5.010 ;</li>

      <li>{</li>

      <li>my @y = ( 1 , 1 );</li>

      <li>sub fib {</li>

      <li>push @y , $y [ 0 ]+ $y [ 1 ];</li>

      <li>return shift @y ;</li>

      <li>}</li>

      <li>}</li>

      <li>say fib ();</li>

      <li>say fib ();</li>

      <li>say fib ();</li>

      <li>say fib ();</li>

      <li>say fib ();</li>
    </ol>
 
<!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/Perlorama/Variables/state_variables.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/Variables/our_variables.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/Variables/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191009X_static_and_state_variables_in_perl"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191009X_use_vars_vs_ours" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191009X_scope_what_is_the_difference_between_my_and_our_in_perl_stack_overflow"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Oct 09, 2019] <a target="_blank" href="https://perlmaven.com/package-variables-and-lexical-variables-in-perl">use vars vs ours</a></h4>

<blockquote>
<h6>Oct 09, 2019 |  <a target="_blank" href= "https://perlmaven.com/package-variables-and-lexical-variables-in-perl">perlmaven.com</a></h6>
 
 

    <p><b>use vars</b></p>

    <p>The problem is that use strict is complaining that there is a variable $x which is not
    declared with my and that it does not know about it. So we need a way to tell strict that it is
    ok. We know about the $x variable and we want to use it, but we want it to be a package
    variable. We don't want to declare it using my and we don't want to always prefix it with the
    package name.</p>

    <p>With use vars ('$x') we can achieve that:</p>

    <ol>
      <li>use strict ;</li>

      <li>package VeryLongName ;</li>

      <li>use vars ( '$x' );</li>

      <li>$x = 23 ;</li>

      <li>print "VeryLongName: $x\n" ;</li>
    </ol>

    <p>This works, but the documentation of vars tells us that <b>the functionality provided by
    this pragma has been superseded by "our" declarations</b> .</p>

    <p>So how does our work?</p><b>our</b>

    <ol>
      <li>use strict ;</li>

      <li>package VeryLongName ;</li>

      <li>our $x = 23 ;</li>

      <li>print "VeryLongName: $x\n" ;</li>
    </ol><b>Caveat</b>

    <p>The our declaration itself is lexically scoped, meaning it is limited by the file or by
    enclosing curly braces. In the next example we don't have curly braces and thus the declaration
    our $x = 23; will be intact even after switching namespaces. This can lead to very unpleasant
    situations. My recommendation is to avoid using our (you almost always need to use my anyway)
    and to put every package in its own file.</p>

    <ol>
      <li>use strict ;</li>

      <li>package VeryLongName ;</li>

      <li>our $x = 23 ;</li>

      <li>print "VeryLongName: $x\n" ; # VeryLongName: 23</li>

      <li>package main ;</li>

      <li>print "$x\n" ; # 23</li>
    </ol>
 <!--TAGS: .  -->

<!--file:///f:/Public_html/Scripting/Perlorama/Variables/our_variables.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/Variables/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191009X_use_vars_vs_ours"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191009X_scope_what_is_the_difference_between_my_and_our_in_perl_stack_overflow" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191009X_perl_import_package_in_different_namespace"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Oct 09, 2019] <a target="_blank" href="https://stackoverflow.com/questions/845060/what-is-the-difference-between-my-and-our-in-perl">scope   - What is the difference between my and our in Perl - Stack Overflow</a></h4>

<blockquote>
<h6>Oct 09, 2019 |  <a target="_blank" href= "https://stackoverflow.com/questions/845060/what-is-the-difference-between-my-and-our-in-perl">stackoverflow.com</a></h6>
 
 

    <p>Asked 10 years, 5 months ago Active <a target="_blank" href=
    "https://stackoverflow.com/questions/845060/what-is-the-difference-between-my-and-our-in-perl?lastactivity">
    3 years, 1 month ago</a> Viewed 107k times 180 56</p>
    <hr noshade align="left" width="10" size="10">

    <p><b><a target="_blank" href="https://stackoverflow.com/users/1084/nathan-fellman">Nathan
    Fellman</a></b> ,May 10, 2009 at 10:24</p>

    <blockquote>
      I know what <code>my</code> is in Perl. It defines a variable that exists only in the scope
      of the block in which it is defined. What does <code>our</code> do? How does <code>our</code>
      differ from <code>my</code> ?
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/1084/nathan-fellman">Nathan
    Fellman</a></b> ,Nov 20, 2016 at 1:15</p>

    <blockquote>
      Great question: How does <i><code>our</code></i> differ from <i><code>my</code></i> and what
      does <i><code>our</code></i> do?

      <p>In Summary:</p>

      <p>Available since Perl 5, <i><code>my</code></i> is a way to declare:</p>

      <ul>
        <li>non-package variables, that are</li>

        <li>private,</li>

        <li><i>new</i> ,</li>

        <li><i>non-global</i> variables,</li>

        <li>separate from any package. So that the variable <i>cannot</i> be accessed in the form
        of <code>$package_name::variable</code> .</li>
      </ul>

      <p><br></p>

      <p>On the other hand, <i><code>our</code></i> variables are:</p>

      <ul>
        <li>package variables, and thus automatically</li>

        <li><i>global</i> variables,</li>

        <li>definitely <i>not private</i> ,</li>

        <li>nor are they necessarily new; and they</li>

        <li><i>can</i> be accessed outside the package (or lexical scope) with the qualified
        namespace, as <code>$package_name::variable</code> .</li>
      </ul>

      <p><br></p>

      <p>Declaring a variable with <i><code>our</code></i> allows you to predeclare variables in
      order to use them under <i><code>use strict</code></i> without getting typo warnings or
      compile-time errors. Since Perl 5.6, it has replaced the obsolete <i><code>use
      vars</code></i> , which was only file-scoped, and not lexically scoped as is
      <i><code>our</code></i> .</p>

      <p>For example, the formal, qualified name for variable <code>$x</code> inside <code>package
      main</code> is <code>$main::x</code> . Declaring <i><code>our $x</code></i> allows you to use
      the bare <code>$x</code> variable without penalty (i.e., without a resulting error), in the
      scope of the declaration, when the script uses <i><code>use strict</code></i> or <i><code>use
      strict "vars"</code></i> . The scope might be one, or two, or more packages, or one small
      block.</p>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/1832712/georg">Georg</a></b>
    ,Oct 1, 2016 at 6:41</p>

    <blockquote>
      The PerlMonks and PerlDoc links from cartman and Olafur are a great reference - below is my
      crack at a summary:

      <p><code>my</code> variables are lexically scoped within a single block defined by
      <code>{}</code> or within the same file if not in <code>{}</code> s. They are not accessible
      from packages/subroutines defined outside of the same lexical scope / block.</p>

      <p><code>our</code> variables are scoped within a package/file and accessible from any code
      that <code>use</code> or <code>require</code> that package/file - name conflicts are resolved
      between packages by prepending the appropriate namespace.</p>

      <p>Just to round it out, <code>local</code> variables are "dynamically" scoped, differing
      from <code>my</code> variables in that they are also accessible from subroutines called
      within the same block.</p>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/1084/nathan-fellman">Nathan
    Fellman</a></b> ,Nov 20, 2015 at 18:46</p>

    <blockquote>
      An example:
      <pre>
use strict;

for (1 .. 2){
    # Both variables are lexically scoped to the block.
    our ($o);  # Belongs to 'main' package.
    my  ($m);  # Does not belong to a package.

    # The variables differ with respect to newness.
    $o ++;
    $m ++;
    print __PACKAGE__, " >> o=$o m=$m\n";  # $m is always 1.

    # The package has changed, but we still have direct,
    # unqualified access to both variables, because the
    # lexical scope has not changed.
    package Fubb;
    print __PACKAGE__, " >> o=$o m=$m\n";
}

# The our() and my() variables differ with respect to privacy.
# We can still access the variable declared with our(), provided
# that we fully qualify its name, but the variable declared
# with my() is unavailable.
print __PACKAGE__, " >> main::o=$main::o\n";  # 2
print __PACKAGE__, " >> main::m=$main::m\n";  # Undefined.

# Attempts to access the variables directly won't compile.
# print __PACKAGE__, " >> o=$o\n";
# print __PACKAGE__, " >> m=$m\n";

# Variables declared with use vars() are like those declared
# with our(): belong to a package; not private; and not new.
# However, their scoping is package-based rather than lexical.
for (1 .. 9){
    use vars qw($uv);
    $uv ++;
}

# Even though we are outside the lexical scope where the
# use vars() variable was declared, we have direct access
# because the package has not changed.
print __PACKAGE__, " >> uv=$uv\n";

# And we can access it from another package.
package Bubb;
print __PACKAGE__, " >> main::uv=$main::uv\n";
</pre>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/59135/daotoad">daotoad</a></b>
    ,May 10, 2009 at 16:37</p>

    <blockquote>
      <a target="_blank" href="http://perl.plover.com/FAQs/Namespaces.html">Coping with Scoping</a>
      is a good overview of Perl scoping rules. It's old enough that <code>our</code> is not
      discussed in the body of the text. It is addressed in the Notes section at the end.

      <p>The article talks about package variables and dynamic scope and how that differs from
      lexical variables and lexical scope.</p>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/78259/chas-owens">Chas.
    Owens</a></b> ,Oct 7, 2013 at 14:02</p>

    <blockquote>
      my is used for local variables, where as our is used for global variables. More reading over
      <a target="_blank" href="http://www.perlmonks.org/?node_id=66677">Variable Scoping in Perl:
      the basics</a> .
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/1028230/ruffin">ruffin</a></b>
    ,Feb 10, 2015 at 19:47</p>

    <blockquote>
      It's an old question, but I ever met some pitfalls about lexical declarations in Perl that
      messed me up, which are also related to this question, so I just add my summary here:

      <p>1. definition or declaration?</p>
      <pre>
local $var = 42; 
print "var: $var\n";
</pre>

      <p>The output is <code>var: 42</code> . However we couldn't tell if <code>local $var =
      42;</code> is a definition or declaration. But how about this:</p>
      <pre>
use strict;
use warnings;

local $var = 42;
print "var: $var\n";
</pre>

      <p>The second program will throw an error:</p>
      <pre>
Global symbol "$var" requires explicit package name.
</pre>

      <p><code>$var</code> is not defined, which means <code>local $var;</code> is just a
      declaration! Before using <code>local</code> to declare a variable, make sure that it is
      defined as a global variable previously.</p>

      <p>But why this won't fail?</p>
      <pre>
use strict;
use warnings;

local $a = 42;
print "var: $a\n";
</pre>

      <p>The output is: <code>var: 42</code> .</p>

      <p>That's because <code>$a</code> , as well as <code>$b</code> , is a global variable
      pre-defined in Perl. Remember the <a target="_blank" href=
      "http://perldoc.perl.org/functions/sort.html">sort</a> function?</p>

      <p>2. lexical or global?</p>

      <p>I was a C programmer before starting using Perl, so the concept of lexical and global
      variables seems straightforward to me: just corresponds to auto and external variables in C.
      But there're small differences:</p>

      <p>In C, an external variable is a variable defined outside any function block. On the other
      hand, an automatic variable is a variable defined inside a function block. Like this:</p>
      <pre>
int global;

int main(void) {
    int local;
}
</pre>

      <p>While in Perl, things are subtle:</p>
      <pre>
sub main {
    $var = 42;
}

&main;

print "var: $var\n";
</pre>

      <p>The output is <code>var: 42</code> , <code>$var</code> is a global variable even it's
      defined in a function block! Actually in Perl, any variable is declared as global by
      default.</p>

      <p>The lesson is to always add <code>use strict; use warnings;</code> at the beginning of a
      Perl program, which will force the programmer to declare the lexical variable explicitly, so
      that we don't get messed up by some mistakes taken for granted.</p>
    </blockquote>

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/users/22459/%C3%93lafur-waage">Ólafur Waage</a></b> ,May 10,
    2009 at 10:25</p>

    <blockquote>
      The <a target="_blank" href="http://perldoc.perl.org/functions/our.html">perldoc</a> has a
      good definition of our.

      <blockquote>
        <p>Unlike my, which both allocates storage for a variable and associates a simple name with
        that storage for use within the current scope, our associates a simple name with a package
        variable in the current package, for use within the current scope. In other words, our has
        the same scoping rules as my, but does not necessarily create a variable.</p>
      </blockquote>
    </blockquote>

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/users/439181/cosmicnet">Cosmicnet</a></b> ,Nov 22, 2014 at 13:57</p>

    <blockquote>
      This is only somewhat related to the question, but I've just discovered a (to me) obscure bit
      of perl syntax that you can use with "our" (package) variables that you can't use with "my"
      (local) variables.
      <pre>
#!/usr/bin/perl

our $foo = "BAR";

print $foo . "\n";
${"foo"} = "BAZ";
print $foo . "\n";
</pre>

      <p>Output:</p>
      <pre>
BAR
BAZ
</pre>

      <p>This won't work if you change 'our' to 'my'.</p>
    </blockquote>

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/users/2596334/okuma-scott">Okuma.Scott</a></b> ,Sep 6, 2014 at
    20:13</p>

    <blockquote>
      <pre>
print "package is: " . __PACKAGE__ . "\n";
our $test = 1;
print "trying to print global var from main package: $test\n";

package Changed;

{
        my $test = 10;
        my $test1 = 11;
        print "trying to print local vars from a closed block: $test, $test1\n";
}

&Check_global;

sub Check_global {
        print "trying to print global var from a function: $test\n";
}
print "package is: " . __PACKAGE__ . "\n";
print "trying to print global var outside the func and from \"Changed\" package:     $test\n";
print "trying to print local var outside the block $test1\n";
</pre>

      <p>Will Output this:</p>
      <pre>
package is: main
trying to print global var from main package: 1
trying to print local vars from a closed block: 10, 11
trying to print global var from a function: 1
package is: Changed
trying to print global var outside the func and from "Changed" package: 1
trying to print local var outside the block
</pre>

      <p>In case using "use strict" will get this failure while attempting to run the script:</p>
      <pre>
Global symbol "$test1" requires explicit package name at ./check_global.pl line 24.
Execution of ./check_global.pl aborted due to compilation errors.
</pre>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/1084/nathan-fellman">Nathan
    Fellman</a></b> ,Nov 5, 2015 at 14:03</p>

    <blockquote>
      Just try to use the following program :
      <pre>
#!/usr/local/bin/perl
use feature ':5.10';
#use warnings;
package a;
{
my $b = 100;
our $a = 10;


print "$a \n";
print "$b \n";
}

package b;

#my $b = 200;
#our $a = 20 ;

print "in package b value of  my b $a::b \n";
print "in package b value of our a  $a::a \n";
</pre>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/1084/nathan-fellman">Nathan
    Fellman</a></b> ,May 16, 2013 at 11:07</p>

    <blockquote>
      <pre>
#!/usr/bin/perl -l

use strict;

# if string below commented out, prints 'lol' , if the string enabled, prints 'eeeeeeeee'
#my $lol = 'eeeeeeeeeee' ;
# no errors or warnings at any case, despite of 'strict'

our $lol = eval {$lol} || 'lol' ;

print $lol;
</pre>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/5844907/evgeniy">Evgeniy</a></b>
    ,Jan 27, 2016 at 4:57</p>

    <blockquote>
      Let us think what an interpreter actually is: it's a piece of code that stores values in
      memory and lets the instructions in a program that it interprets access those values by their
      names, which are specified inside these instructions. So, the big job of an interpreter is to
      shape the rules of how we should use the names in those instructions to access the values
      that the interpreter stores.

      <p>On encountering "my", the interpreter creates a lexical variable: a named value that the
      interpreter can access only while it executes a block, and only from within that syntactic
      block. On encountering "our", the interpreter makes a lexical alias of a package variable: it
      binds a name, which the interpreter is supposed from then on to process as a lexical
      variable's name, until the block is finished, to the value of the package variable with the
      same name.</p>

      <p>The effect is that you can then pretend that you're using a lexical variable and bypass
      the rules of 'use strict' on full qualification of package variables. Since the interpreter
      automatically creates package variables when they are first used, the side effect of using
      "our" may also be that the interpreter creates a package variable as well. In this case, two
      things are created: a package variable, which the interpreter can access from everywhere,
      provided it's properly designated as requested by 'use strict' (prepended with the name of
      its package and two colons), <i>and</i> its lexical alias.</p>

      <p>Sources:</p>

      <ul>
        <li><a target="_blank" href=
        "http://perldoc.perl.org/functions/our.html">http://perldoc.perl.org/functions/our.html</a></li>

        <li><a target="_blank" href=
        "http://perldoc.perl.org/perlsub.html#Private-Variables-via-my()">http://perldoc.perl.org/perlsub.html#Private-Variables-via-my()</a></li>
      </ul>
    </blockquote>
 <!--TAGS: . ~/Scripting -->

<!--file:///f:/Public_html/Scripting/Perlorama/Variables/our_variables.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/Variables/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>


</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191009X_scope_what_is_the_difference_between_my_and_our_in_perl_stack_overflow"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191009X_perl_import_package_in_different_namespace" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191009X_oop_perl_importing_variables_from_calling_module"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Oct 09, 2019] <a target="_blank" href="https://stackoverflow.com/questions/52562323/perl-import-package-in-different-namespace">Perl   Import Package in different Namespace</a></h4>

<blockquote>
<h6>Oct 09, 2019 |  <a target="_blank" href= "https://stackoverflow.com/questions/52562323/perl-import-package-in-different-namespace">stackoverflow.com</a></h6>
 
 

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/questions/52562323/perl-import-package-in-different-namespace">Perl
    Import Package in different Namespace</a></b> <a target="_blank" href=
    "https://stackoverflow.com/questions/ask">Ask Question</a> Asked 1 year ago Active <a target=
    "_blank" href=
    "https://stackoverflow.com/questions/52562323/perl-import-package-in-different-namespace?lastactivity">
    7 months ago</a> Viewed 150 times We're doing things differently. <a target="_blank" href=
    "https://stackoverflow.com/jobs/companies/root">View all 8 job openings!</a> 2</p>
    <hr noshade align="left" width="10" size="10">

    <p><b><a target="_blank" href="https://stackoverflow.com/users/1030675/choroba">choroba</a></b>
    ,Sep 28, 2018 at 22:17</p>

    <blockquote>
      is it possible to import ( <code>use</code> ) a perl module within a different namespace?

      <p>Let's say I have a Module <code>A</code> (XS Module with no methods Exported
      <code>@EXPORT</code> is empty) and I have no way of changing the module.</p>

      <p>This Module has a Method <code>A::open</code></p>

      <p>currently I can use that Module in my main program (package main) by calling
      <code>A::open</code> I would like to have that module inside my <code>package main</code> so
      that I can directly call <code>open</code></p>

      <p>I tried to manually push every key of <code>%A::</code> into <code>%main::</code> however
      that did not work as expected.</p>

      <p>The only way that I know to achieve what I want is by using <code>package A;</code> inside
      my main program, effectively changing the package of my program from <code>main</code> to
      <code>A</code> . Im not satisfied with this. I would really like to keep my program inside
      package main.</p>

      <p>Is there any way to achieve this and still keep my program in package main?</p>

      <p><i>Offtopic: Yes I know usually you would not want to import everything into your
      namespace but this module is used by us extensively and we don't want to type A:: (well the
      actual module name is way longer which isn't making the situation better)in front of hundreds
      or thousands of calls</i></p>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/5848200/grinnz">Grinnz</a></b>
    ,Oct 1, 2018 at 6:26</p>

    <blockquote>
      This is one of those "impossible" situations, where the clear solution -- to rework that
      module -- is off limits.

      <p>But, you <i>can</i> alias that package's subs names, from its symbol table, to the same
      names in <code>main</code> . Worse than being rude, this comes with a glitch: it catches all
      names that that package itself imported in any way. However, since this package is a fixed
      quantity it stands to reason that you can establish that list (and even hard-code it). It is
      just this one time, right?</p>

      <p>main</p>
      <pre>
use warnings;
use strict;
use feature 'say';

use OffLimits;

GET_SUBS: {
    # The list of names to be excluded
    my $re_exclude = qr/^(?:BEGIN|import)$/;  # ...
    my @subs = grep { !/$re_exclude/ } sort keys %OffLimits::;
    no strict 'refs';
    for my $sub_name (@subs) {
        *{ $sub_name } = \&{ 'OffLimits::' . $sub_name };
    }   
};

my $name = name('name() called from ' . __PACKAGE__);
my $id   = id('id() called from ' . __PACKAGE__);

say "name() returned: $name";
say "id()   returned: $id";
</pre>

      <p>with <code>OffLimits.pm</code></p>
      <pre>
package OffLimits;    
use warnings;
use strict;

sub name { return "In " .  __PACKAGE__ . ": @_" }
sub id   { return "In " .  __PACKAGE__ . ": @_" }

1;
</pre>

      <p>It prints</p>
      <pre>
name() returned: In OffLimits: name() called from  main
id()   returned: In OffLimits: id() called from  main
</pre>

      <p>You may need that code in a <code>BEGIN</code> block, depending on other details.</p>

      <p>Another option is of course to hard-code the subs to be "exported" (in <code>@subs</code>
      ). Given that the module is in practice immutable this option is reasonable and more
      reliable.</p>
      <hr>

      <p>This can also be wrapped in a module, so that you have the normal, selective,
      importing.</p>

      <p>WrapOffLimits.pm</p>
      <pre>
package WrapOffLimits;
use warnings;
use strict;

use OffLimits;

use Exporter qw(import);

our @sub_names;
our @EXPORT_OK   = @sub_names;
our %EXPORT_TAGS = (all => \@sub_names);

BEGIN { 
    # Or supply a hard-coded list of all module's subs in @sub_names
    my $re_exclude = qr/^(?:BEGIN|import)$/;  # ...
    @sub_names = grep { !/$re_exclude/ } sort keys %OffLimits::;

    no strict 'refs';
    for my $sub_name (@sub_names) {
        *{ $sub_name } = \&{ 'OffLimits::' . $sub_name };
    }   
};
1;
</pre>

      <p>and now in the caller you can import either only some subs</p>
      <pre>
use WrapOffLimits qw(name);
</pre>

      <p>or all</p>
      <pre>
use WrapOffLimits qw(:all);
</pre>

      <p>with otherwise the same main as above for a test.</p>

      <p>The module name is hard-coded, which should be OK as this is meant only for that
      module.</p>
      <hr>

      <p>The following is added mostly for completeness.</p>

      <p>One can pass the module name to the wrapper by writing one's own <code>import</code> sub,
      which is what gets used then. The import list can be passed as well, at the expense of an
      awkward interface of the <code>use</code> statement.</p>

      <p>It goes along the lines of</p>
      <pre>
package WrapModule;
use warnings;
use strict;

use OffLimits;

use Exporter qw();  # will need our own import 

our ($mod_name, @sub_names);

our @EXPORT_OK   = @sub_names;
our %EXPORT_TAGS = (all => \@sub_names);

sub import {
    my $mod_name = splice @_, 1, 1;  # remove mod name from @_ for goto

    my $re_exclude = qr/^(?:BEGIN|import)$/;  # etc

    no strict 'refs';
    @sub_names = grep { !/$re_exclude/ } sort keys %{ $mod_name . '::'};    
    for my $sub_name (@sub_names) {    
        *{ $sub_name } = \&{ $mod_name . '::' . $sub_name };
    }   

    push @EXPORT_OK, @sub_names;

    goto &Exporter::import;
}
1;
</pre>

      <p>what can be used as</p>
      <pre>
use WrapModule qw(OffLimits name id);  # or (OffLimits :all)
</pre>

      <p>or, with the list broken-up so to remind the user of the unusual interface</p>
      <pre>
use WrapModule 'OffLimits', qw(name id);
</pre>

      <p>When used with the main above this prints the same output.</p>

      <p>The <code>use</code> statement ends up using the <a target="_blank" href=
      "https://perldoc.perl.org/functions/import.html">import</a> sub defined in the module, which
      exports symbols by writing to the caller's symbol table. (If no <code>import</code> sub is
      written then the <code>Exporter</code> 's <code>import</code> method is nicely used, which is
      how this is normally done.)</p>

      <p>This way we are able to unpack the arguments and have the module name supplied at
      <code>use</code> invocation. With the import list supplied as well now we have to
      <code>push</code> manually to <code>@EXPORT_OK</code> since this can't be in the
      <code>BEGIN</code> phase. In the end the sub is replaced by <code>Exporter::import</code> via
      the (good form of) <a target="_blank" href=
      "http://perldoc.perl.org/functions/goto.html">goto</a> , to complete the job.</p>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/8419020/simerax">Simerax</a></b>
    ,Sep 30, 2018 at 10:19</p>

    <blockquote>
      You can forcibly "import" a function into main using glob assignment to alias the subroutine
      (and you want to do it in BEGIN so it happens at compile time, before calls to that
      subroutine are parsed later in the file):
      <pre>
use strict;
use warnings;
use Other::Module;

BEGIN { *open = \&Other::Module::open }
</pre>

      <p>However, another problem you might have here is that open is a builtin function, which may
      cause some <a target="_blank" href=
      "https://perldoc.pl/perlsub#Overriding-Built-in-Functions">problems</a> . You can add
      <code>use subs 'open';</code> to indicate that you want to override the built-in function in
      this case, since you aren't using an actual import function to do so.</p>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/5848200/grinnz">Grinnz</a></b>
    ,Sep 30, 2018 at 17:33</p>

    <blockquote>
      Here is what I now came up with. Yes this is hacky and yes I also feel like I opened pandoras
      box with this. However at least a small dummy program ran perfectly fine.

      <p>I renamed the module in my code again. In my original post I used the example
      <code>A::open</code> actually this module does not contain any method/variable reserved by
      the perl core. This is why I blindly import everything here.</p>
      <pre>
BEGIN {
    # using the caller to determine the parent. Usually this is main but maybe we want it somewhere else in some cases
    my ($parent_package) = caller;

    package A;

    foreach (keys(%A::)) {
        if (defined $$_) {
            eval '*'.$parent_package.'::'.$_.' = \$A::'.$_;
        }
        elsif (%$_) {
            eval '*'.$parent_package.'::'.$_.' = \%A::'.$_;
        }
        elsif (@$_) {
            eval '*'.$parent_package.'::'.$_.' = \@A::'.$_;
        }
        else {
            eval '*'.$parent_package.'::'.$_.' = \&A::'.$_;
        }
    }
}
</pre>
    </blockquote>
 <!--TAGS: . ~/Scripting -->

<!--file:///f:/Public_html/Scripting/Perlorama/perl_namespaces.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>


</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191009X_perl_import_package_in_different_namespace"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191009X_oop_perl_importing_variables_from_calling_module" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191009X_package_variables"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Oct 09, 2019] <a target="_blank" href="https://stackoverflow.com/questions/3612972/perl-importing-variables-from-calling-module">oop -   Perl Importing Variables From Calling Module</a></h4>

<blockquote>
<h6>Oct 09, 2019 |  <a target="_blank" href= "https://stackoverflow.com/questions/3612972/perl-importing-variables-from-calling-module">stackoverflow.com</a></h6>
 
 

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/questions/3612972/perl-importing-variables-from-calling-module">Perl
    Importing Variables From Calling Module</a></b> <a target="_blank" href=
    "https://stackoverflow.com/questions/ask">Ask Question</a> Asked 9 years, 1 month ago Active
    <a target="_blank" href=
    "https://stackoverflow.com/questions/3612972/perl-importing-variables-from-calling-module?lastactivity">
    9 years, 1 month ago</a> Viewed 4k times 0 1</p>
    <hr noshade align="left" width="10" size="10">

    <p><b><a target="_blank" href="https://stackoverflow.com/users/191205/russell-c">Russell
    C.</a></b> ,Aug 31, 2010 at 20:31</p>

    <blockquote>
      I have a Perl module (Module.pm) that initializes a number of variables, some of which I'd
      like to import ($VAR2, $VAR3) into additional submodules that it might load during execution.

      <p>The way I'm currently setting up Module.pm is as follows:</p>
      <pre>
package Module;

use warnings;
use strict;

use vars qw($SUBMODULES $VAR1 $VAR2 $VAR3);

require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw($VAR2 $VAR3);

sub new {
    my ($package) = @_;
    my $self = {};
    bless ($self, $package);
    return $self;
}

sub SubModules1 {
    my $self = shift;
    if($SUBMODULES->{'1'}) { return $SUBMODULES->{'1'}; }

    # Load & cache submodule
    require Module::SubModule1;
    $SUBMODULES->{'1'} = Module::SubModule1->new(@_);    
    return $SUBMODULES->{'1'};
}

sub SubModules2 {
    my $self = shift;
    if($SUBMODULES->{'2'}) { return $SUBMODULES->{'2'}; }

    # Load & cache submodule
    require Module::SubModule2;
    $SUBMODULES->{'2'} = Module::SubModule2->new(@_);    
    return $SUBMODULES->{'2'};
}
</pre>

      <p>Each submodule is structured as follows:</p>
      <pre>
package Module::SubModule1;

use warnings;
use strict;
use Carp;

use vars qw();

sub new {
    my ($package) = @_;
    my $self = {};
    bless ($self, $package);
    return $self;
}
</pre>

      <p>I want to be able to import the $VAR2 and $VAR3 variables into each of the submodules
      without having to reference them as $Module::VAR2 and $Module::VAR3. I noticed that the
      calling script is able to access both the variables that I have exported in Module.pm in the
      desired fashion but SubModule1.pm and SubModule2.pm still have to reference the variables as
      being from Module.pm.</p>

      <p>I tried updating each submodule as follows which unfortunately didn't work I was
      hoping:</p>
      <pre>
package Module::SubModule1;

use warnings;
use strict;
use Carp;

use vars qw($VAR2 $VAR3);

sub new {
    my ($package) = @_;
    my $self = {};
    bless ($self, $package);
    $VAR2 = $Module::VAR2;
    $VAR3 = $Module::VAR3;
    return $self;
}
</pre>

      <p>Please let me know how I can successfully export $VAR2 and $VAR3 from Module.pm into each
      Submodule. Thanks in advance for your help!</p>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/191205/russell-c">Russell
    C.</a></b> ,Aug 31, 2010 at 22:37</p>

    <blockquote>
      In your submodules, are you forgetting to say
      <pre>
use Module;
</pre>

      <p>? Calling <code>use Module</code> from another package (say
      <code>Module::Submodule9</code> ) will try to run the <code>Module::import</code> method.
      Since you don't have that method, it will call the <code>Exporter::import</code> method, and
      that is where the magic that exports <code>Module</code> 's variables into the
      <code>Module::Submodule9</code> namespace will happen.</p>
      <hr>

      <p>In your program there is only one <code>Module</code> namespace and only one instance of
      the (global) variable <code>$Module::VAR2</code> . Exporting creates aliases to this variable
      in other namespaces, so the same variable can be accessed in different ways. Try this in a
      separate script:</p>
      <pre>
package Whatever;
use Module;
use strict;
use vars qw($VAR2);

$Module::VAR2 = 5;
print $Whatever::VAR2;    # should be 5.
$VAR2 = 14;               # same as $Whatever::VAR2 = 14
print $Module::VAR2;      # should be 14
</pre>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/191205/russell-c">Russell
    C.</a></b> ,Aug 31, 2010 at 21:38</p>

    <blockquote>
      Well there is the easy way:

      <p>In M.pm:</p>
      <pre>
package M;

use strict;
use warnings;

#our is better than "use vars" for creating package variables
#it creates an alias to $M::foo named $foo in the current lexical scope 
our $foo = 5;

sub inM { print "$foo\n" }

1;
</pre>

      <p>In M/S.pm</p>
      <pre>
package M;

#creates an alias to $M::foo that will last for the entire scope,
#in this case the entire file
our $foo;

package M::S;

use strict;
use warnings;

sub inMS { print "$foo\n" }

1;
</pre>

      <p>In the script:</p>
      <pre>
#!/usr/bin/perl

use strict;
use warnings;

use M;
use M::S;

M::inM();
M::S::inMS();
</pre>

      <p>But I would advise against this. Global variables are not a good practice, and sharing
      global variables between modules is even worse.</p>
    </blockquote>
 <!--TAGS: . ~/Scripting -->

<!--file:///f:/Public_html/Scripting/Perlorama/perl_namespaces.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>


</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191009X_oop_perl_importing_variables_from_calling_module"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191009X_package_variables" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20191008X_perl_constant_array"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Oct 09, 2019] <a target="_blank" href="https://perlmaven.com/package-variables-and-lexical-variables-in-perl">Package   variables</a></h4>

<blockquote>
<h6>Oct 09, 2019 |  <a target="_blank" href= "https://perlmaven.com/package-variables-and-lexical-variables-in-perl">perlmaven.com</a></h6>
 
 

    <p>These are the oldest type of variables in Perl. They are still used in some cases, even
    though in most cases you should just use lexical variables.</p>

    <p>In old times, if we started to use a variable without declaring it with the my or state
    keywords, we automatically got a variable in the current namespace. Thus we could write:</p>

    <ol>
      <li>$x = 42 ;</li>

      <li>print "$x\n" ; # 42</li>
    </ol>

    <p>Please note, we don't use strict; in these examples. Even though you should <a target=
    "_blank" href="https://perlmaven.com/strict">always use strict</a> . We'll fix this in a
    bit.</p>

    <p>The default namespace in every perl script is called "main" and you can always access
    variables using their full name including the namespace:</p>

    <ol>
      <li>$x = 42 ;</li>

      <li>print "$x\n" ; # 42</li>

      <li>print "$main::x\n" ; # 42</li>
    </ol>

    <p>The package keyword is used to switch namespaces:</p>

    <ol>
      <li>$x = 42 ;</li>

      <li>print "$x\n" ; # 42</li>

      <li>print "$main::x\n" ; # 42</li>

      <li>package Foo ;</li>

      <li>print "Foo: $x\n" ; # Foo:</li>
    </ol>

    <p>Please note, once we switched to the "Foo" namespace, the $x name refers to the variable in
    the Foo namespace. It does not have any value yet.</p>

    <ol>
      <li>$x = 42 ;</li>

      <li>print "$x\n" ; # 42</li>

      <li>print "$main::x\n" ; # 42</li>

      <li>package Foo ;</li>

      <li>print "Foo: $x\n" ; # Foo:</li>

      <li>$x = 23 ;</li>

      <li>print "Foo: $x\n" ; # Foo 23;</li>
    </ol>

    <p>Do we really have two $x-es? Can we reach the $x in the main namespace while we are in the
    Foo namespace?</p>

    <ol>
      <li>$x = 42 ;</li>

      <li>print "$x\n" ; # 42</li>

      <li>print "$main::x\n" ; # 42</li>

      <li>package Foo ;</li>

      <li>print "Foo: $x\n" ; # Foo:</li>

      <li>$x = 23 ;</li>

      <li>print "Foo: $x\n" ; # Foo 23</li>

      <li>print "main: $main::x\n" ; # main: 42</li>

      <li>print "Foo: $Foo::x\n" ; # Foo: 23</li>

      <li>package main ;</li>

      <li>print "main: $main::x\n" ; # main: 42</li>

      <li>print "Foo: $Foo::x\n" ; # Foo: 23</li>

      <li>print "$x\n" ; # 42</li>
    </ol>

    <p>We even switched back to the main namespace (using package main; ) and if you look closely,
    you can see that while we were already in the main package we could reach to the $x of the Foo
    package using $Foo::x but if we accessed $x without the full package name, we reach the one in
    the main namespace.</p>

    <p>Every package (or namespace) can hold variables with the same name.</p>
 <!--TAGS: .  -->

<!--file:///f:/Public_html/Scripting/Perlorama/perl_namespaces.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191009X_package_variables"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20191008X_perl_constant_array" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190930X_int_perldoc_perl_org"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Oct 08, 2019] <a target="_blank" href="https://stackoverflow.com/questions/18188393/perl-constant-array">Perl constant array</a></h4>

<blockquote>
<h6>Oct 08, 2019 |  <a target="_blank" href= "https://stackoverflow.com/questions/18188393/perl-constant-array">stackoverflow.com</a></h6>
 
 

    <p><a target="_blank" href="https://stackoverflow.com/questions/ask">Ask Question</a> Asked 6
    years, 1 month ago Active <a target="_blank" href=
    "https://stackoverflow.com/questions/18188393/perl-constant-array?lastactivity">4 years ago</a>
    Viewed 5k times 4 1</p>
    <hr noshade align="left" width="10" size="10">

    <p><b><a target="_blank" href="https://stackoverflow.com/users/927587/alec">Alec</a></b> ,Sep
    5, 2018 at 8:25</p>

    <blockquote>
      <pre>
use constant {
    COLUMNS => qw/ TEST1 TEST2 TEST3 /,
}
</pre>

      <p>Can I store an array using the constant package in Perl?</p>

      <p>Whenever I go on to try to use the array like <code>my @attr = (COLUMNS);</code> , it does
      not contain the values.</p>
    </blockquote>

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/users/223226/%D0%A1%D1%83%D1%85%D0%BE%D0%B927">Сухой27</a></b>
    ,Aug 12, 2013 at 13:37</p>

    <blockquote>
      <pre>
use constant {
  COLUMNS => [qw/ TEST1 TEST2 TEST3 /],
};

print @{+COLUMNS};
</pre>
    </blockquote>

    <p><b>></b> ,</p>

    <blockquote>
      Or remove the curly braces as the <a target="_blank" href=
      "http://perldoc.perl.org/constant.html">docs</a> show :-
      <pre>
  1 use strict;
  2 use constant COLUMNS => qw/ TEST1 TEST2 TEST3 /;
  3 
  4 my @attr = (COLUMNS);
  5 print @attr;
</pre>

      <p>which gives :-</p>
      <pre>
 % perl test.pl
TEST1TEST2TEST3
</pre>

      <p>Your code actually defines two constants COLUMNS and TEST2 :-</p>
      <pre>
use strict;
use constant { COLUMNS => qw/ TEST1 TEST2 TEST3 /, };

my @attr = (COLUMNS);
print @attr;
print TEST2
</pre>

      <p>and gives :-</p>
      <pre>
% perl test.pl
TEST1TEST3
</pre>
    </blockquote>
 <!--TAGS: . ~/Scripting -->

<!--file:///f:/Public_html/Scripting/Perlorama/Variables/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>


</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20191008X_perl_constant_array"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190930X_int_perldoc_perl_org" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190924X_warn_perldoc_perl_org"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 30, 2019] <a target="_blank" href="https://perldoc.perl.org/functions/int.html">int - perldoc.perl.org</a></h4>

<blockquote>
<h6>Sep 30, 2019 |  <a target="_blank" href= "https://perldoc.perl.org/functions/int.html">perldoc.perl.org</a></h6>
 
 

    <ul>
      <li>int EXPR</li>
    </ul>

    <ul>
      <li>int

        <p>Returns the integer portion of EXPR. If EXPR is omitted, uses <a target="_blank" href=
        "https://perldoc.perl.org/perlvar.html#%24_">$_</a> . You should not use this function for
        rounding: one because it truncates towards <code>0</code> , and two because machine
        representations of floating-point numbers can sometimes produce counterintuitive
        results.</p>

        <p>For example, <code><a target="_blank" href=
        "https://perldoc.perl.org/functions/int.html">int(-6.725/0.025)</a></code> produces -268
        rather than the correct -269; that's because it's really more like
        -268.99999999999994315658 instead.</p>

        <p>Usually, the <a target="_blank" href=
        "https://perldoc.perl.org/functions/int.html#sprintf-FORMAT%2c-LIST">sprintf</a> ,
        <a target="_blank" href=
        "https://perldoc.perl.org/functions/int.html#printf-FILEHANDLE-FORMAT%2c-LIST">printf</a> ,
        or the <a target="_blank" href="https://perldoc.perl.org/POSIX.html#floor">POSIX::floor</a>
        and <a target="_blank" href="https://perldoc.perl.org/POSIX.html#ceil">POSIX::ceil</a>
        functions will serve you better than will <a target="_blank" href=
        "https://perldoc.perl.org/functions/int.html#int-EXPR">int</a> .</p>
      </li>
    </ul>
 
<!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_subroutnes_and_functions.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190930X_int_perldoc_perl_org"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190924X_warn_perldoc_perl_org" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190921X_namespaces"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 24, 2019] <a target="_blank" href="https://perldoc.perl.org/functions/warn.html">warn -   perldoc.perl.org</a></h4>

<blockquote>
<h6>Sep 24, 2019 |  <a target="_blank" href= "https://perldoc.perl.org/functions/warn.html">perldoc.perl.org</a></h6>
 

    <p><b>Perl 5 version 30.0 documentation</b> <b>warn</b> <a target="_blank" href=
    "https://perldoc.perl.org/5.30.0/index-functions.html">Perl functions A-Z</a> | <a target=
    "_blank" href="https://perldoc.perl.org/5.30.0/index-functions-by-cat.html">Perl functions by
    category</a> | <a target="_blank" href="https://perldoc.perl.org/5.30.0/perlfunc.html">The
    'perlfunc' manpage</a></p>

    <ul>
      <li>warn LIST

        <p>Emits a warning, usually by printing it to <code>STDERR</code> . <code><a target=
        "_blank" href="https://perldoc.perl.org/functions/warn.html">warn</a></code> interprets its
        operand LIST in the same way as <code><a target="_blank" href=
        "https://perldoc.perl.org/functions/die.html">die</a></code> , but is slightly different in
        what it defaults to when LIST is empty or makes an empty string. If it is empty and
        <a target="_blank" href="https://perldoc.perl.org/perlvar.html#%24%40">$@</a> already
        contains an exception value then that value is used after appending
        <code>"\t...caught"</code> . If it is empty and <code>$@</code> is also empty then the
        string <code>"Warning: Something's wrong"</code> is used.</p>

        <p>By default, the exception derived from the operand LIST is stringified and printed to
        <code>STDERR</code> . This behaviour can be altered by installing a <a target="_blank" href="https://perldoc.perl.org/perlvar.html#%25SIG">$SIG{__WARN__}</a> handler. If there is
        such a handler then no message is automatically printed; it is the handler's responsibility
        to deal with the exception as it sees fit (like, for instance, converting it into a
        <a target="_blank" href="https://perldoc.perl.org/functions/warn.html#die-LIST">die</a> ).
        Most handlers must therefore arrange to actually display the warnings that they are not
        prepared to deal with, by calling <a target="_blank" href=
        "https://perldoc.perl.org/functions/warn.html#warn-LIST">warn</a> again in the handler.
        Note that this is quite safe and will not produce an endless loop, since
        <code>__WARN__</code> hooks are not called from inside one.</p>

        <p>You will find this behavior is slightly different from that of <a target="_blank" href=
        "https://perldoc.perl.org/perlvar.html#%25SIG">$SIG{__DIE__}</a> handlers (which don't
        suppress the error text, but can instead call <a target="_blank" href=
        "https://perldoc.perl.org/functions/warn.html#die-LIST">die</a> again to change it).</p>

        <p>Using a <code>__WARN__</code> handler provides a powerful way to silence all warnings
        (even the so-called mandatory ones). An example:</p>

        <ol>
          <li># wipe out *all* compile-time warnings</li>

          <li><a target="_blank" href="https://perldoc.perl.org/functions/BEGIN.html">BEGIN</a> {
          $SIG { '__WARN__' } = <a target="_blank" href=
          "https://perldoc.perl.org/functions/sub.html">sub</a> { <a target="_blank" href=
          "https://perldoc.perl.org/functions/warn.html">warn</a> $_ [ 0 ] <a target="_blank" href=
          "https://perldoc.perl.org/functions/if.html">if</a> $DOWARN } }</li>

          <li><a target="_blank" href="https://perldoc.perl.org/functions/my.html">my</a> $foo = 10
          ;</li>

          <li><a target="_blank" href="https://perldoc.perl.org/functions/my.html">my</a> $foo = 20
          ; # no warning about duplicate my $foo,</li>

          <li># but hey, you asked for it!</li>

          <li># no compile-time or run-time warnings before here</li>

          <li>$DOWARN = 1 ;</li>

          <li># run-time warnings enabled after here</li>

          <li><a target="_blank" href="https://perldoc.perl.org/functions/warn.html">warn</a>
          "\$foo is alive and $foo!" ; # does show up</li>
        </ol>

        <p>See <a target="_blank" href="https://perldoc.perl.org/perlvar.html">perlvar</a> for
        details on setting <a target="_blank" href=
        "https://perldoc.perl.org/perlvar.html#%25SIG">%SIG</a> entries and for more examples. See
        the <a target="_blank" href="https://perldoc.perl.org/Carp.html">Carp</a> module for other
        kinds of warnings using its <code>carp</code> and <code>cluck</code> functions.</p>
      </li>
    </ul>
 <!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_debugging.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190924X_warn_perldoc_perl_org"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190921X_namespaces" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190921X_writing_perl_modules_tutorialspoint"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 21, 2019] <a target="_blank" href="https://perl.plover.com/FAQs/Namespaces.html">Namespaces</a></h4>

<blockquote>
<h6>Sep 21, 2019 |  <a target="_blank" href= "https://perl.plover.com/FAQs/Namespaces.html">perl.plover.com</a></h6>
 
 

    <p><b>Coping with Scoping</b></p>

    <p>© Copyright 1998 The Perl Journal. Reprinted with permission.</p>

    <p><a target="_blank" href="http://alpage.org/static_html/Les_espaces_de_nom.html">Cet article
    est également disponible en Français</a></p>

    <p><a target="_blank" href="http://www.perl.it/documenti/articoli/namespaces/index.html">Questo
    articolo è disponibile anche in Italiano</a></p>

    <p><a target="_blank" href="http://aktuell.de.selfhtml.org/artikel/cgiperl/scoping/">Dieser
    Artikel ist auch in deutscher Übersetzung verfügbar</a></p>

    <ul>
      <li>
        <a target="_blank" href=
        "https://perl.plover.com/FAQs/Namespaces.html#Just_the_FAQs_Coping_with_Scopi">The
        Article:</a>

        <ul>
          <li><a target="_blank" href=
          "https://perl.plover.com/FAQs/Namespaces.html#Just_the_FAQs_Coping_with_Scopi">Just the
          FAQs: Coping with Scoping</a></li>

          <li><a target="_blank" href=
          "https://perl.plover.com/FAQs/Namespaces.html#Package_Variables">Package
          Variables</a></li>

          <li><a target="_blank" href=
          "https://perl.plover.com/FAQs/Namespaces.html#The_Current_Package">The Current
          Package</a></li>

          <li><a target="_blank" href=
          "https://perl.plover.com/FAQs/Namespaces.html#Package_Variable_Trivia">Package Variable
          Trivia</a></li>

          <li><a target="_blank" href=
          "https://perl.plover.com/FAQs/Namespaces.html#Lexical_Variables">Lexical
          Variables</a></li>

          <li><a target="_blank" href=
          "https://perl.plover.com/FAQs/Namespaces.html#C_local_and_C_my_"><tt>local</tt> and
          <tt>my</tt></a></li>

          <li><a target="_blank" href=
          "https://perl.plover.com/FAQs/Namespaces.html#What_Good_is_C_local_">What Good is
          <tt>local</tt> ?</a></li>

          <li><a target="_blank" href=
          "https://perl.plover.com/FAQs/Namespaces.html#When_to_Use_C_my_and_When_to_Us">When to
          Use <tt>my</tt> and When to Use <tt>local</tt></a></li>

          <li><a target="_blank" href=
          "https://perl.plover.com/FAQs/Namespaces.html#Other_Properties_of_C_my_Variab">Other
          Properties of <tt>my</tt> Variables</a></li>

          <li><a target="_blank" href=
          "https://perl.plover.com/FAQs/Namespaces.html#C_my_Variable_Trivia"><tt>my</tt> Variable
          Trivia</a></li>

          <li><a target="_blank" href=
          "https://perl.plover.com/FAQs/Namespaces.html#Declarations">Declarations</a></li>

          <li><a target="_blank" href=
          "https://perl.plover.com/FAQs/Namespaces.html#Summary">Summary</a></li>
        </ul>
      </li>

      <li><a target="_blank" href=
      "https://perl.plover.com/FAQs/Namespaces.html#Glossary">Glossary</a></li>

      <li><a target="_blank" href=
      "https://perl.plover.com/FAQs/Namespaces.html#Notes">Notes</a></li>
    </ul>
    <hr>
    <b><a name="Just_the_FAQs_Coping_with_Scopi" id="Just_the_FAQs_Coping_with_Scopi">Just the
    FAQs: Coping with Scoping</a></b>

    <p>In the Beginning, some time around 1960, every part of your program had access to all the
    variables in every other part of the program. That turned out to be a problem, so language
    designers invented local variables, which were visible in only a small part of the program.
    That way, programmers who used a variable <tt>x</tt> could be sure that nobody was able to
    tamper with the contents of <tt>x</tt> behind their back. They could also be sure that by using
    <tt>x</tt> they weren't tampering with someone else's variable by mistake.</p>

    <p>Every programming language has a philosophy, and these days most of these philosophies have
    to do with the way the names of variables are managed. Details of which variables are visible
    to which parts of the program, and what names mean what, and when, are of prime importance. The
    details vary from somewhat baroque, in languages like Lisp, to extremely baroque, in languages
    like C++. Perl unfortunately, falls somewhere towards the rococo end of this scale.</p>

    <p>The problem with Perl isn't that it has no clearly-defined system of name management, but
    rather that it two systems, both working at once. Here's the Big Secret about Perl variables
    that most people learn too late: Perl has <i>two</i> completely separate, independent sets of
    variables. One is left over from Perl 4, and the other is new. The two sets of variables are
    called `package variables' and `lexical variables', and they have nothing to do with each
    other.</p>

    <p>Package variables came first, so we'll talk about them first. Then we'll see some problems
    with package variables, and how lexical variables were introduced in Perl 5 to avoid these
    problems. Finally, we'll see how to get Perl to automatically diagnose places where you might
    not be getting the variable you meant to get, which can find mistakes before they turn into
    bugs.</p><b><a name="Package_Variables" id="Package_Variables">Package Variables</a></b>
    <pre>
        $x = 1
</pre>

    <p>Here, <tt>$x</tt> is a <a name="glos_package_variable" id="glos_package_variable"><i>package
    variable</i></a> . There are two important things to know about package variables:</p>

    <ol>
      <li>Package variables are what you get if you don't say otherwise.</li>

      <li>Package variables are <i>always</i> global.</li>
    </ol>

    <p><a name="glos_global" id="glos_global"><i>Global</i></a> means that package variables are
    always visible everywhere in every program. After you do <tt>$x = 1</tt> , any other part of
    the program, even some other subroutine defined in some other file, can inspect and modify the
    value of <tt>$x</tt> . There's no exception to this; package variables are always global.</p>

    <p>Package variables are divided into families, called <a name="glos_packages" id=
    "glos_packages"><i>packages</i></a> . Every package variable has a name with two parts. The two
    parts are analogous to the variable's given name and family name. You can call the
    Vice-President of the United States `Al', if you want, but that's really short for his full
    name, which is `Al Gore'. Similarly, <tt>$x</tt> has a full name, which is something like
    <tt>$main::x</tt> . The <tt>main</tt> part is the <a name="glos_package_qualifier" id=
    "glos_package_qualifier"><i>package qualifier</i></a> , analogous to the `Gore' part of `Al
    Gore'. Al Gore and Al Capone are different people even though they're both named `Al'. In the
    same way, <tt>$Gore::Al</tt> and <tt>$Capone::Al</tt> are different variables, and
    <tt>$main::x</tt> and <tt>$DBI::x</tt> are different variables.</p>

    <p>You're always allowed to include the package part of the variable's name, and if you do,
    Perl will know exactly which variable you mean. But for brevity, you usually like to leave the
    package qualifier off. What happens if you do?</p><b><a name="The_Current_Package" id=
    "The_Current_Package">The Current Package</a></b>

    <p>If you just say <tt>$x</tt> , perl assumes that you mean the variable <tt>$x</tt> in the
    current package. What's the current package? It's normally <tt>main</tt> , but you can change
    the current package by writing</p>
    <pre>
        package Mypackage;
</pre>

    <p>in your program; from that point on, the current package is <tt>Mypackage</tt> . The only
    thing the current package does is affect the interpretation of package variables that you wrote
    without package names. If the current package is <tt>Mypackage</tt> , then <tt>$x</tt> really
    means <tt>$Mypackage::x</tt> . If the current package is <tt>main</tt> , then <tt>$x</tt>
    really means $main::x.</p>

    <p>If you were writing a module, let's say the <tt>MyModule</tt> module, you would probably put
    a line like this at the top of the module file:</p>
    <pre>
        package MyModule;
</pre>

    <p>From there on, all the package variables you used in the module file would be in package
    <tt>MyModule</tt> , and you could be pretty sure that those variables wouldn't conflict with
    the variables in the rest of the program. It wouldn't matter if both you and the author of
    <tt>DBI</tt> were to use a variable named <tt>$x</tt> , because one of those <tt>$x</tt> es
    would be <tt>$MyModule::x</tt> and the other would be <tt>$DBI::x</tt> .</p>

    <p>Remember that package variables are always global. Even if you're not in package DBI, even
    if you've never <i>heard</i> of package DBI, nothing can stop you from reading from or writing
    to <tt>$DBI::errstr</tt> . You don't have to do anything special. <tt>$DBI::errstr</tt> , like
    all package variables, is a global variable, and it's available globally; all you have to do is
    mention its full name to get it. You could even say</p>
    <pre>
        package DBI;
        $errstr = 'Ha ha Tim!';
</pre>

    <p>and that would modify <tt>$DBI::errstr</tt> .</p><b><a name="Package_Variable_Trivia" id=
    "Package_Variable_Trivia">Package Variable Trivia</a></b>

    <p>There are only three other things to know about package variables, and you might want to
    skip them on the first reading:</p>

    <ol>
      <li>The package with the empty name is the same as <tt>main</tt> . So <tt>$::x</tt> is the
      same as <tt>$main::x</tt> for any <tt>x</tt> .</li>

      <li>Some variables are always forced to be in package main. For example, if you mention
      <tt>%ENV</tt> , Perl assumes that you mean <tt>%main::ENV</tt> , even if the current package
      isn't <tt>main</tt> . If you want <tt>%Fred::ENV</tt> , you have to say so explicitly, even
      if the current package is <tt>Fred</tt> . Other names that are special this way include
      <tt>INC</tt> , all the one-punctuation-character names like <tt>$_</tt> and <tt>$$</tt> ,
      <tt>@ARGV</tt> , and <tt>STDIN</tt> , <tt>STDOUT</tt> , and <tt>STDERR</tt> .</li>

      <li>Package names, but not variable names, can contain <tt>::</tt> . You can have a variable
      named <tt>$DBD::Oracle::x.</tt> This means the variable <tt>x</tt> in the package
      <tt>DBD::Oracle</tt> ; it has nothing at all to do with the package <tt>DBD</tt> which is
      unrelated. Isaac Newton is not related to Olivia Newton-John, and <tt>Newton::Isaac</tt> is
      not related to <tt>Newton::John::Olivia</tt> . Even though it appears that they both begin
      with <tt>Newton</tt> , the appearance is deceptive. <tt>Newton::John::Olivia</tt> is in
      package <tt>Newton::John</tt> , not package Newton.</li>
    </ol>

    <p>That's all there is to know about package variables.</p>

    <p>Package variables are global, which is dangerous, because you can never be sure that someone
    else isn't tampering with them behind your back. Up through Perl 4, all variables were package
    variables, which was worrisome. So Perl 5 added new variables that aren't
    global.</p><b><a name="Lexical_Variables" id="Lexical_Variables">Lexical Variables</a></b>

    <p>Perl's other set of variables are called <a name="glos_lexical_variable" id=
    "glos_lexical_variable"><i>lexical variables</i></a> (we'll see why later) or <i>private
    variables</i> because they're private. They're also sometimes called <i>my variables</i>
    because they're always declared with <tt>my</tt> . It's tempting to call them `local
    variables', because their effect is confined to a small part of the program, but don't do that,
    because people might think you're talking about Perl's <tt>local</tt> operator, which we'll see
    later. When you want a `local variable', think <tt>my</tt> , not <tt>local</tt> .</p>

    <p>The declaration</p>
    <pre>
        my $x;
</pre>

    <p>creates a new variable, named <tt>x</tt> , which is totally inaccessible to most parts of
    the program---anything outside the block where the variable was declared. This block is called
    the <a name="glos_scope" id="glos_scope"><i>scope</i></a> of the variable. If the variable
    wasn't declared in any block, its scope is from the place it was declared to the end of the
    file.</p>

    <p>You can also declare and initialize a my variable by writing something like</p>
    <pre>
        my $x = 119;
</pre>

    <p>You can declare and initialize several at once:</p>
    <pre>
        my ($x, $y, $z, @args) = (5, 23, @_);
</pre>

    <p>Let's see an example of where some private variables will be useful. Consider this
    subroutine:</p>
    <pre>
        sub print_report {
          @employee_list = @_;
          foreach $employee (@employee_list) {
            $salary = lookup_salary($employee);
            print_partial_report($employee, $salary);
          }
        }
</pre>

    <p>If <tt>lookup_salary</tt> happens to also use a variable named <tt>$employee</tt> , that's
    going to be the same variable as the one used in <tt>print_report</tt> , and the works might
    get gummed up. The two programmers responsible for <tt>print_report</tt> and
    <tt>lookup_salary</tt> will have to coordinate to make sure they don't use the same variables.
    That's a pain. In fact, in even a medium-sized project, it's an intolerable pain.</p>

    <p>The solution: Use <tt>my</tt> variables:</p>
    <pre>
        sub print_report {
          my @employee_list = @_;
          foreach my $employee (@employee_list) {
            my $salary = lookup_salary($employee);
            print_partial_report($employee, $salary);
          }
        }
</pre>

    <p><tt>my @employee_list</tt> creates a new array variable which is totally inaccessible
    outside the <tt>print_report</tt> function. <tt>for my $employee</tt> creates a new scalar
    variable which is totally inaccessible outside the <tt>foreach</tt> loop, as does <tt>my
    $salary</tt> . You don't have to worry that the other functions in the program are tampering
    with these variables, because they can't; they don't know where to find them, because the names
    have different meanings outside the scope of the <tt>my</tt> declarations. These `my variables'
    are sometimes called `lexical' because their scope depends only on the program text itself, and
    not on details of execution, such as what gets executed in what order. You can determine the
    scope by inspecting the source code without knowing what it does. Whenever you see a variable,
    look for a <tt>my</tt> declaration higher up in the same block. If you find one, you can be
    sure that the variable is inaccessible outside that block. If you don't find a declaration in
    the smallest block, look at the next larger block that contains it, and so on, until you do
    find one. If there is no <tt>my</tt> declaration anywhere, then the variable is a package
    variable.</p>

    <p><tt>my</tt> variables are not package variables. They're not part of a package, and they
    don't have package qualifiers. The current package has no effect on the way they're
    interpreted. Here's an example:</p>
    <pre>
        my $x = 17;

        package A;
        $x = 12;

        package B;
        $x = 20;

        # $x is now 20.
        # $A::x and $B::x are still undefined
</pre>

    <p>The declaration <tt>my $x = 17</tt> at the top creates a new lexical variable named x whose
    scope continues to the end of the file. This new meaning of <tt>$x</tt> overrides the default
    meaning, which was that <tt>$x</tt> meant the package variable <tt>$x</tt> in the current
    package.</p>

    <p><tt>package A</tt> changes the current package, but because <tt>$x</tt> refers to the
    lexical variable, not to the package variable, <tt>$x=12</tt> doesn't have any effect on
    <tt>$A::x</tt> . Similarly, after <tt>package B</tt> , <tt>$x=20</tt> modifies the lexical
    variable, and not any of the package variables.</p>

    <p>At the end of the file, the lexical variable <tt>$x</tt> holds 20, and the package variables
    <tt>$main::x</tt> , <tt>$A::x</tt> , and <tt>$B::x</tt> are still undefined. If you had wanted
    them, you could still have accessed them by using their full names.</p>

    <p>The maxim you must remember is:</p>

    <p>Package variables are global variables.<br>
    For private variables, you must use <tt>my</tt> .</p><b><a name="C_local_and_C_my_" id=
    "C_local_and_C_my_"><tt>local</tt> and <tt>my</tt></a></b>

    <p>Almost everyone already knows that there's a <tt>local</tt> function that has something to
    do with local variables. What is it, and how does it related to <tt>my</tt> ? The answer is
    simple, but bizarre:</p>

    <p><tt>my</tt> creates a local variable. <tt>local</tt> doesn't.</p>

    <p>First, here's what <tt>local $x</tt> really does: It saves the current value of the
    <i>package</i> variable <tt>$x</tt> in a safe place, and replaces it with a new value, or with
    <tt>undef</tt> if no new value was specified. It also arranges for the old value to be restored
    when control leaves the current block. The variables that it affects are package variables,
    which get <tt>local</tt> values. But package variables are always global, and a <tt>local</tt>
    package variable is no exception. To see the difference, try this:</p>
    <pre>
        $lo = 'global';
        $m  = 'global';
        A();

        sub A {
          local $lo = 'AAA';
          my    $m  = 'AAA';
          B();
        }

        sub B {
          print "B ", ($lo eq 'AAA' ? 'can' : 'cannot') ,
                " see the value of lo set by A.\n";

          print "B ", ($m  eq 'AAA' ? 'can' : 'cannot') ,
                " see the value of m  set by A.\n";
        }
</pre>

    <p>This prints</p>
    <pre>
        B can see the value of lo set by A.
        B cannot see the value of m  set by A.
</pre>

    <p>What happened here? The <tt>local</tt> declaration in <tt>A</tt> saved a new temporary
    value, <tt>AAA</tt> , in the package variable <tt>$lo</tt> . The old value, <tt>global</tt> ,
    will be restored when <tt>A</tt> returns, but before that happens, <tt>A</tt> calls <tt>B</tt>
    . <tt>B</tt> has no problem accessing the contents of <tt>$lo</tt> , because <tt>$lo</tt> is a
    package variable and package variables are always available everywhere, and so it sees the
    value <tt>AAA</tt> set by <tt>A</tt> .</p>

    <p>In contrast, the <tt>my</tt> declaration created a new, lexically scoped variable named
    <tt>$m</tt> , which is only visible inside of function <tt>A</tt> . Outside of <tt>A</tt> ,
    <tt>$m</tt> retains its old meaning: It refers the the package variable <tt>$m</tt> ; which is
    still set to <tt>global</tt> . This is the variable that <tt>B</tt> sees. It doesn't see the
    <tt>AAA</tt> because the variable with that value is a lexical variable, and only exists inside
    of <tt>A</tt> .</p><b><a name="What_Good_is_C_local_" id="What_Good_is_C_local_">What Good is
    <tt>local</tt> ?</a></b>

    <p>Because <tt>local</tt> does not actually create local variables, it is not very much use.
    If, in the example above, <tt>B</tt> happened to modify the value of <tt>$lo</tt> , then the
    value set by A would be overwritten. That is exactly what we don't want to happen. We want each
    function to have its own variables that are untouchable by the others. This is what <tt>my</tt>
    does.</p>

    <p>Why have <tt>local</tt> at all? The answer is 90% history. Early versions of Perl only had
    global variables. <tt>local</tt> was very easy to implement, and was added to Perl 4 as a
    partial solution to the local variable problem. Later, in Perl 5, more work was done, and real
    local variables were put into the language. But the name <tt>local</tt> was already taken, so
    the new feature was invoked with the word <tt>my</tt> . <tt>my</tt> was chosen because it
    suggests privacy, and also because it's very short; the shortness is supposed to encourage you
    to use it instead of <tt>local</tt> . <tt>my</tt> is also faster than <tt>local</tt>
    .</p><b><a name="When_to_Use_C_my_and_When_to_Us" id="When_to_Use_C_my_and_When_to_Us">When to
    Use <tt>my</tt> and When to Use <tt>local</tt></a></b>

    <p>Always use <tt>my</tt> ; never use <tt>local</tt> .</p>

    <p>Wasn't that easy?</p><b><a name="Other_Properties_of_C_my_Variab" id=
    "Other_Properties_of_C_my_Variab">Other Properties of <tt>my</tt> Variables</a></b>

    <p>Every time control reaches a <tt>my</tt> declaration, Perl creates a new, fresh variable.
    For example, this code prints <tt>x=1</tt> fifty times:</p>
    <pre>
        for (1 .. 50) {
          my $x;
          $x++;
          print "x=$x\n";
        }
</pre>

    <p>You get a new <tt>$x</tt> , initialized to <tt>undef</tt> , every time through the loop.</p>

    <p>If the declaration were outside the loop, control would only pass by it once, so there would
    only be one variable:</p>
    <pre>
        { my $x;
          for (1 .. 50) {
            $x++;
            print "x=$x\n";
          }     
        }

</pre>

    <p>This prints <tt>x=1</tt> , <tt>x=2</tt> , <tt>x=3</tt> , ... <tt>x=50</tt> .</p>

    <p>You can use this to play a useful trick. Suppose you have a function that needs to remember
    a value from one call to the next. For example, consider a random number generator. A typical
    random number generator (like Perl's <tt>rand</tt> function) has a <i>seed</i> in it. The seed
    is just a number. When you ask the random number generator for a random number, the function
    performs some arithmetic operation that scrambles the seed, and it returns the result. It also
    saves the result and uses it as the seed for the next time it is called.</p>

    <p>Here's typical code: (I stole it from the ANSI C standard, but it behaves poorly, so don't
    use it for anything important.)</p>
    <pre>
        $seed = 1;
        sub my_rand {
          $seed = int(($seed * 1103515245 + 12345) / 65536) % 32768;
          return $seed;
        }
</pre>

    <p>And typical output:</p>
    <pre>
        16838
        14666
        10953
        11665
        7451
        26316
        27974
        27550
</pre>

    <p>There's a problem here, which is that <tt>$seed</tt> is a global variable, and that means we
    have to worry that someone might inadvertently tamper with it. Or they might tamper with it on
    purpose, which could affect the rest of the program. What if the function were used in a
    gambling program, and someone tampered with the random number generator?</p>

    <p>But we can't declare <tt>$seed</tt> as a <tt>my</tt> variable in the function:</p>
    <pre>
        sub my_rand {
          my $seed;
          $seed = int(($seed * 1103515245 + 12345) / 65536) % 32768;
          return $seed;
        }
</pre>

    <p>If we did, it would be initialized to <tt>undef</tt> every time we called <tt>my_rand</tt> .
    We need it to retain its value between calls to <tt>my_rand</tt> .</p>

    <p>Here's the solution:</p>
    <pre>
        { my $seed = 1;
          sub my_rand {
            $seed = int(($seed * 1103515245 + 12345) / 65536) % 32768;
            return $seed;
          }
        }
</pre>

    <p>The declaration is outside the function, so it only happens once, at the time the program is
    compiled, not every time the function is called. But it's a <tt>my</tt> variable, and it's in a
    block, so it's only accessible to code inside the block. <tt>my_rand</tt> is the only other
    thing in the block, so the <tt>$seed</tt> variable is only accessible to the <tt>my_rand</tt>
    function.</p>

    <p><tt>$seed</tt> here is sometimes called a `static' variable, because it stays the same in
    between calls to the function. (And because there's a similar feature in the C language that is
    activated by the <tt>static</tt> keyword.)</p><b><a name="C_my_Variable_Trivia" id=
    "C_my_Variable_Trivia"><tt>my</tt> Variable Trivia</a></b>

    <ol>
      <li>You can't declare a variable <tt>my</tt> if its name is a punctuation character, like
      <tt>$_</tt> , <tt>@_</tt> , or <tt>$$</tt> . You can't declare the backreference variables
      <tt>$1</tt> , <tt>$2</tt> , ... as <tt>my</tt> . The authors of <tt>my</tt> thought that that
      would be too confusing.</li>

      <li>Obviously, you can't say <tt>my $DBI::errstr</tt> , because that's contradictory---it
      says that the package variable <tt>$DBI::errstr</tt> is now a lexical variable. But you
      <i>can</i> say <tt>local $DBI::errstr</tt> ; it saves the current value of
      <tt>$DBI::errstr</tt> and arranges for it to be restored at the end of the block.</li>

      <li>New in Perl 5.004, you can write
        <pre>
        foreach my $i (@list) {
</pre>

        <p>instead, to confine the <tt>$i</tt> to the scope of the loop instead. Similarly,</p>
        <pre>
        for (my $i=0; $i<100; $i++) {
</pre>

        <p>confines the scope of <tt>$i</tt> to the <tt>for</tt> loop.</p>
      </li>
    </ol><b><a name="Declarations" id="Declarations">Declarations</a></b>

    <p>If you're writing a function, and you want it to have private variables, you need to declare
    the variables with <tt>my</tt> . What happens if you forget?</p>
    <pre>
        sub function {
          $x = 42;        # Oops, should have been my $x = 42.
        }
</pre>

    <p>In this case, your function modifies the global package variable <tt>$x</tt> . If you were
    using that variable for something else, it could be a disaster for your program.</p>

    <p>Recent versions of Perl have an optional protection against this that you can enable if you
    want. If you put</p>
    <pre>
        use strict 'vars';
</pre>

    <p>at the top of your program, Perl will <i>require</i> that package variables have an explicit
    package qualifier. The <tt>$x</tt> in <tt>$x=42</tt> has no such qualifier, so the program
    won't even compile; instead, the compiler will abort and deliver this error message:</p>
    <pre>
        Global symbol "$x" requires explicit package name at ...
</pre>

    <p>If you wanted <tt>$x</tt> to be a private <tt>my</tt> variable, you can go back and add the
    <tt>my</tt> . If you really wanted to use the global package variable, you could go back and
    change it to</p>
    <pre>
        $main::x = 42;
</pre>

    <p>or whatever would be appropriate.</p>

    <p>Just saying <tt>use strict</tt> turns on <tt>strict vars</tt> , and several other checks
    besides. See <tt>perldoc strict</tt> for more details.</p>

    <p>Now suppose you're writing the <tt>Algorithms::KnuthBendix</tt> modules, and you want the
    protections of <tt>strict vars</tt> But you're afraid that you won't be able to finish the
    module because your fingers are starting to fall off from typing
    <tt>$Algorithms::KnuthBendix::Error</tt> all the time.</p>

    <p><a name="glos_use_vars" id="glos_use_vars">You can save your fingers and tell <tt>strict
    vars</tt> to make an exception:</a></p>
    <pre>
        package Algorithms::KnuthBendix;
        use vars '$Error';
</pre>

    <p>This exempts the package variable <tt>$Algorithms::KnuthBendix::Error</tt> from causing a
    <tt>strict vars</tt> failure if you refer to it by its short name, <tt>$Error</tt> .</p>

    <p>You can also turn <tt>strict vars</tt> off for the scope of one block by writing</p>
    <pre>
        { no strict 'vars';

          # strict vars is off for the rest of the block.

        }
</pre><b><a name="Summary" id="Summary">Summary</a></b>

    <p>Package variables are always global. They have a name and a package qualifier. You can omit
    the package qualifier, in which case Perl uses a default, which you can set with the
    <tt>package</tt> declaration. For private variables, use <tt>my</tt> . Don't use <tt>local</tt>
    ; it's obsolete.</p>

    <p>You should avoid using global variables because it can be hard to be sure that no two parts
    of the program are using one another's variables by mistake.</p>

    <p>To avoid using global variables by accident, add <tt>use strict 'vars'</tt> to your program.
    It checks to make sure that all variables are either declared private, are explicitly qualified
    with package qualifiers, or are explicitly declared with <tt>use vars</tt> .</p>
    <hr>
    <b><a name="Glossary" id="Glossary">Glossary</a></b>

    <ul>
      <li><a target="_blank" href=
      "https://perl.plover.com/FAQs/Namespaces.html#glos_package_variable">global variable</a></li>

      <li><a target="_blank" href=
      "https://perl.plover.com/FAQs/Namespaces.html#glos_global">global</a></li>

      <li><a target="_blank" href=
      "https://perl.plover.com/FAQs/Namespaces.html#glos_lexical_variable">lexical
      variable</a></li>

      <li><a target="_blank" href=
      "https://perl.plover.com/FAQs/Namespaces.html#C_local_and_C_my_"><tt>local</tt>
      declaration</a></li>

      <li><a target="_blank" href=
      "https://perl.plover.com/FAQs/Namespaces.html#glos_lexical_variable"><tt>my</tt></a></li>

      <li><a target="_blank" href=
      "https://perl.plover.com/FAQs/Namespaces.html#Lexical_Variables"><tt>my</tt>
      declaration</a></li>

      <li><a target="_blank" href=
      "https://perl.plover.com/FAQs/Namespaces.html#glos_lexical_variable"><tt>my</tt>
      variable</a></li>

      <li><a target="_blank" href=
      "https://perl.plover.com/FAQs/Namespaces.html#The_Current_Package"><tt>package</tt>
      declaration</a></li>

      <li><a target="_blank" href=
      "https://perl.plover.com/FAQs/Namespaces.html#glos_package_qualifier">package
      qualifier</a></li>

      <li><a target="_blank" href=
      "https://perl.plover.com/FAQs/Namespaces.html#glos_package_variable">package
      variable</a></li>

      <li><a target="_blank" href=
      "https://perl.plover.com/FAQs/Namespaces.html#glos_lexical_variable">private
      variable</a></li>

      <li><a target="_blank" href=
      "https://perl.plover.com/FAQs/Namespaces.html#glos_scope">scope</a></li>

      <li><a target="_blank" href=
      "https://perl.plover.com/FAQs/Namespaces.html#Declarations"><tt>use strict vars</tt></a></li>

      <li><a target="_blank" href=
      "https://perl.plover.com/FAQs/Namespaces.html#glos_use_vars"><tt>use vars</tt></a></li>
    </ul>
    <hr>
    <b><a name="Notes" id="Notes">Notes</a></b>

    <ol>
      <li>The tech editors complained about my maxim `Never use <tt>local</tt> .' But 97% of the
      time, the maxim is exactly right. <tt>local</tt> has a few uses, but only a few, and they
      don't come up too often, so I left them out, because the whole point of a tutorial article is
      to present 97% of the utility in 50% of the space.

        <p>I was still afraid I'd get a lot of tiresome email from people saying ``You forgot to
        mention that <tt>local</tt> can be used for such-and-so, you know.'' So in the colophon at
        the end of the article, I threatened to deliver <i>Seven Useful Uses for <tt>local</tt></i>
        in three months. I mostly said it to get people off my back about <tt>local</tt> . But it
        turned out that I did write it, and it was published some time later.</p>

        <p><a target="_blank" href="https://perl.plover.com/local.html"><cite>The Seven Useful Uses
        of <tt>local</tt></cite></a> is now available on the web site. It appeared in <cite>The
        Perl Journal</cite> issue #14.</p>
      </li>

      <li>Here's another potentially interesting matter that I left out for space and clarity. I
      got email from Robert Watkins with a program he was writing that didn't work. The essence of
      the bug looked like this:
        <pre>
        my $x;

        for $x (1..5) {
          s();
        }

        sub s { print "$x, " }
</pre>

        <p>Robert wanted this to print <tt>1, 2, 3, 4, 5,</tt> but it did not. Instead, it printed
        <tt>, , , , ,</tt> . Where did the values of <tt>$x</tt> go?</p>

        <p>The deal here is that normally, when you write something like this:</p>
        <pre>
                    for $x (...) { }
</pre>

        <p>Perl wants to confine the value of the index variable to inside the loop. If <tt>$x</tt>
        is a package variable, it pretends that you wrote this instead:</p>
        <pre>
        { local $x; for $x (...) { } }
</pre>

        <p>But if $x is a lexical variable, it pretends you wrote this instead, instead:</p>
        <pre>
        { my $x;    for $x (...) { } }
</pre>

        <p>This means that the loop index variable won't get propagated to subroutines, even if
        they're in the scope of the original declaration.</p>

        <p>I probably shouldn't have gone on at such length, because the <i>perlsyn</i> manual page
        describes it pretty well:</p>

        <blockquote>
          ...the variable is implicitly local to the loop and regains its former value upon exiting
          the loop. If the variable was previously declared with <tt>my</tt> , it uses that
          variable instead of the global one, but it's still localized to the loop. (Note that a
          lexically scoped variable can cause problems if you have subroutine or format
          declarations within the loop which refer to it.)
        </blockquote>

        <p>In my opinion, lexically scoping the index variable was probably a mistake. If you had
        wanted that, you would have written <tt>for my $x ...</tt> in the first place. What I would
        have liked it to do was to localize the lexical variable: It could save the value of the
        lexical variable before the loop, and restore it again afterwards. But there may be
        technical reasons why that couldn't be done, because this doesn't work either:</p>
        <pre>
   my $m;
        { local $m = 12;
          ...
        }
</pre>

        <p>The <tt>local</tt> fails with this error message:</p>
        <pre>
   Can't localize lexical variable $m...
</pre>

        <p>There's been talk on P5P about making this work, but I gather it's not trivial.</p>
      </li>

      <li>Added 2000-01-05: Perl 5.6.0 introduced a new <tt>our(...)</tt> declaration. Its syntax
      is the same as for <tt>my()</tt> , and it is a replacement for <tt>use vars</tt> .

        <p>Without getting into the details, <tt>our()</tt> is just like <tt>use vars</tt> ; its
        only effect is to declare variables so that they are exempt from the <tt>strict 'vars'</tt>
        checking. It has two possible advantages over <tt>use vars</tt> , however: Its syntax is
        less weird, and its effect is lexical. That is, the exception that it creates to the
        <tt>strict</tt> checking continues only to the end of the current block:</p>
        <pre>
        use strict 'vars';
        {
          our($x);
          $x = 1;   # Use of global variable $x here is OK
        }
        $x = 2;     # Use of $x here is a compile-time error as usual
</pre>

        <p>So whereas <tt>use vars '$x'</tt> declares that it is OK to use the global variable
        <tt>$x</tt> everywhere, <tt>our($x)</tt> allows you to say that global <tt>$x</tt> should
        be permitted only in certain parts of your program, and should still be flagged as an error
        if you accidentally use it elsewhere.</p>
      </li>

      <li>Added 2000-01-05: Here's a little wart that takes people by surprise. Consider the
      following program:
        <pre>
        use strict 'vars';
        my @lines = <>;
        my @sorted = sort backwards @lines;
        print @sorted;

        sub backwards { $b cmp $a }
</pre>

        <p>Here we have not declared <tt>$a</tt> or <tt>$b</tt> , so they are global variables. In
        fact, they have to be global, because the <tt>sort</tt> operator must to be able to set
        them up for the <tt>backwards</tt> function. Why doesn't <tt>strict</tt> produce a
        failure?</p>

        <p>The variables <tt>$a</tt> and <tt>$b</tt> are exempted from <tt>strict vars</tt>
        checking, for exactly this reason.</p>
      </li>
    </ol>
 <!--TAGS: .  -->

<!--file:///f:/Public_html/Scripting/Perlorama/perl_namespaces.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
</blockquote>


</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190921X_namespaces"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190921X_writing_perl_modules_tutorialspoint" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190921X_larry_wall_present_continuous_future_perfect_osdcisrael_wiki"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 21, 2019] <a target="_blank" href="https://www.tutorialspoint.com/perl/perl_modules.htm">Writing PERL Modules - Tutorialspoint </a></h4>

<blockquote>
<h6>Sep 21, 2019 |  <a target="_blank" href="https://www.tutorialspoint.com/perl/perl_modules.htm">www.tutorialspoint.com </a> </h6>
 

   <p><b>What are Packages? </b></p>
   <ul>

      <li>A package is a collection of code which lives in its own namespace </li>

      <li>A namespace is a named collection of unique variable names (also called a symbol table). </li>

      <li>Namespaces prevent variable name collisions between packages </li>

      <li>Packages enable the construction of modules which, when used, won't clobbber variables and functions outside of the modules's 
      own namespace </li>
   </ul>
   <b>The Package Statement </b>
   <ul>

      <li>
<the >
<b=""> package statement switches the current naming context to a specified namespace (symbol table)
</the>
      </li>

      <li>If the named package does not exists, a new namespace is first created. </li>
   </ul>

   <pre>$i = 1; print "$i\n"; # Prints "1"
package foo;
$i = 2; print "$i\n"; # Prints "2"
package main;
print "$i\n"; # Prints "1"
</pre>
   <ul>

      <li>The package stays in effect until either another package statement is invoked, or until the end of the end of the current 
      block or file. </li>

      <li>You can explicitly refer to variables within a package using the <b>:: </b>package qualifier </li>
   </ul>

   <pre>$PACKAGE_NAME::VARIABLE_NAME

For Example:
$i = 1; print "$i\n"; # Prints "1"
package foo;
$i = 2; print "$i\n"; # Prints "2"
package main;
print "$i\n"; # Prints "1"

print "$foo::i\n"; # Prints "2"
</pre>
   <b>BEGIN and END Blocks </b>

   <p>You may define any number of code blocks named BEGIN and END which act as constructors and destructors respectively. </p>

   <pre>BEGIN { ... }
END { ... }
BEGIN { ... }
END { ... }
</pre>
   <ul>

      <li>Every <b>BEGIN </b>block is executed after the perl script is loaded and compiled but before any other statement is executed
      </li>

      <li>Every END block is executed just before the perl interpreter exits. </li>

      <li>The BEGIN and END blocks are particularly useful when creating Perl modules. </li>
   </ul>
   <b>What are Perl Modules? </b>

   <p>A Perl module is a reusable package defined in a library file whose name is the same as the name of the package (with a .pm on 
   the end). </p>

   <p>A Perl module file called "Foo.pm" might contain statements like this. </p>

   <pre>#!/usr/bin/perl

package Foo;
sub bar { 
   print "Hello $_[0]\n" 
}

sub blat { 
   print "World $_[0]\n" 
}
1;
</pre>

   <p>Few noteable points about modules </p>
   <ul>

      <li>The functions <b>require </b>and <b>use </b>will load a module. </li>

      <li>Both use the list of search paths in <b>@INC </b>to find the module (you may modify it!) </li>

      <li>Both call the <b>eval </b>function to process the code </li>

      <li>The <b>1; </b>at the bottom causes eval to evaluate to TRUE (and thus not fail) </li>
   </ul>
   <b>The Require Function </b>

   <p>A module can be loaded by calling the <b>require </b>function </p>

   <pre>#!/usr/bin/perl

require Foo;

Foo::bar( "a" );
Foo::blat( "b" );
</pre>

   <p>Notice above that the subroutine names must be fully qualified (because they are isolated in their own package) </p>

   <p>It would be nice to enable the functions bar and blat to be imported into our own namespace so we wouldn't have to use the Foo:: 
   qualifier. </p>
   <b>The Use Function </b>

   <p>A module can be loaded by calling the <b>use </b>function </p>

   <pre>#!/usr/bin/perl

use Foo;

bar( "a" );
blat( "b" );
</pre>

   <p>Notice that we didn't have to fully qualify the package's function names? </p>

   <p>The use function will export a list of symbols from a module given a few added statements inside a module </p>

   <pre>require Exporter;
@ISA = qw(Exporter);
</pre>

   <p>Then, provide a list of symbols (scalars, lists, hashes, subroutines, etc) by filling the list variable named <b>@EXPORT </b>: 
   For Example </p>

   <pre>package Module;

require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(bar blat);

sub bar { print "Hello $_[0]\n" }
sub blat { print "World $_[0]\n" }
sub splat { print "Not $_[0]\n" }  # Not exported!

1;
</pre>
   <b>Create the Perl Module Tree </b>

   <p>When you are ready to ship your PERL module then there is standard way of creating a Perl Module Tree. This is done using <b>h2xs
   </b>utility. This utility comes alongwith PERL. Here is the syntax to use h2xs </p>

   <pre>$h2xs -AX -n  Module Name

# For example, if your module is available in Person.pm file
$h2xs -AX -n Person

This will produce following result
Writing Person/lib/Person.pm
Writing Person/Makefile.PL
Writing Person/README
Writing Person/t/Person.t
Writing Person/Changes
Writing Person/MANIFEST
</pre>

   <p>Here is the descritpion of these options </p>
   <ul>

      <li><b>-A </b>omits the Autoloader code (best used by modules that define a large number of infrequently used subroutines)
      </li>

      <li><b>-X </b>omits XS elements (eXternal Subroutine, where eXternal means external to Perl, i.e. C) </li>

      <li><b>-n </b>specifies the name of the module </li>
   </ul>

   <p>So above command creates the following structure inside Person directory. Actual result is shown above. </p>
   <ul>

      <li>Changes </li>

      <li>Makefile.PL </li>

      <li>MANIFEST (contains the list of all files in the package) </li>

      <li>README </li>

      <li>t/ (test files) </li>

      <li>lib/ ( Actual source code goes here </li>
   </ul>

   <p>So finally you <b>tar </b>this directory structure into a file Person.tar and you can ship it. You would have to update README 
   file with the proper instructions. You can provide some test examples files in t directory. </p>
   <b>Installing Perl Module </b>

   <p>Installing a Perl Module is very easy. Use the following sequence to install any Perl Module. </p>

   <pre>perl Makefile.PL
make
make install
</pre>

   <p>The Perl interpreter has a list of directories in which it searches for modules (global array @INC) </p>
   <!--TAGS: .  -->

<!--file:///f:/Public_html/Scripting/Perlorama/perl_modules.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190921X_writing_perl_modules_tutorialspoint"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190921X_larry_wall_present_continuous_future_perfect_osdcisrael_wiki" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190921X_dr_dobb_s_journal_february_1998_a_conversation_with_larry_wall"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 21, 2019] <a target="_blank" href="http://perl.org.il/presentations/larry-wall-present-continuous-future-perfect/transcript.html">Larry Wall -  Present Continuous, Future Perfect - OSDCIsrael Wiki</a></h4>

<h5>You can see that Larry Wall bought OO paradigm "hook, line and sinker" , and that was very bad, IMHO disastrous decision. There 
were several areas were Perl 5 could be more profitably be extended such as exceptions, coroutines and, especially, introducing types 
of variables. He also did not realize that Javascript prototypes based OO model has much better implementation of OO then Simula-67 
model. And that Perl 5 modules do 80% of what is useful in classes (namely provide a separate namespace and the ability to share variables 
in this namespace between several subroutines)</h5>
<h5>Notable quotes:</h5>
<h5>"...  Perl 5 had this problem with "do" loops because they weren't real loops - they were a "do" block followed by a statement modifier,     and people kept wanting to use loop control it them. Well, we can fix that. "loop" now is a real loop. And it allows a modifier on     it but still behaves as a real loop. And so, do goes off to have other duties, and you can write a loop that tests at the end and     it is a real loop. And this is just one of many many many things that confused new Perl 5 programmers. ..."</h5>
<h5>"...  We have properties which you can put on variables and onto values. These are generalizations of things that were special code     in Perl 5, but now we have general mechanisms to do the same things, they're actually done using a mix-in mechanism like Ruby. ..."</h5>
<h5>"...  Smart match operators is, like Damian say, equal-tilda ("=~") on steroids. Instead of just allowing a regular expression on the     right side it allows basically anything, and it figures out that this wants to do a numeric comparison, this wants to do a string     comparison, this wants to compare two arrays, this wants to do a lookup in the hash; this wants to call the closure on the right     passing in the left argument, and it will tell if you if $x can quack. Now that looks a little strange because you can just say "$x.can('quack')".     Why would you do it this way? Well, you'll see. ..."</h5>
<blockquote>
<h6>Feb 26, 2006 |  <a target="_blank" href="http://perl.org.il/presentations/larry-wall-present-continuous-future-perfect/transcript.html">perl.org.il</a></h6>
 
 

   <p><b>Irrationalities in Other Languages (5:54)</b></p>

   <p>Now, I'm not the only language designer with irrationalities. You can think of some languages to go with some of these things.</p>

   <p>"We've got to start over from scratch" - Well, that's almost any academic language you find.</p>

   <p>"English phrases" - We'll that's Cobol. You know, cargo cult English. ( <i>laughter</i> )</p>

   <p>"Text processing doesn't matter much" - Fortran.</p>

   <p>"Simple languages produce simple solutions" - C.</p>

   <p>"If I wanted it fast, I'd write it in C" - That's almost a direct quote from the original awk page.</p>

   <p>"I thought of a way to do it so it must be right" - That's obviously PHP. ( <i>laughter and applause</i> )</p>

   <p>"You can build anything with NAND gates" - Any language designed by an electrical engineer. ( <i>laughter</i> )</p>

   <p>"This is a very high level language, who cares about bits?" - The entire scope of fourth generation languages fell into this... 
   problem.</p>

   <p>"Users care about elegance" - A lot of languages from Europe tend to fall into this. You know, Eiffel.</p>

   <p>"The specification is good enough" - Ada.</p>

   <p>"Abstraction equals usability" - Scheme. Things like that.</p>

   <p>"The common kernel should be as small as possible" - Forth.</p>

   <p>"Let's make this easy for the computer" - Lisp. ( <i>laughter</i> )</p>

   <p>"Most programs are designed top-down" - Pascal. ( <i>laughter</i> )</p>

   <p>"Everything is a vector" - APL.</p>

   <p>"Everything is an object" - Smalltalk and its children. (whispered:) Ruby. ( <i>laughter</i> )</p>

   <p>"Everything is a hypothesis" - Prolog. ( <i>laughter</i> )</p>

   <p>"Everything is a function" - Haskell. ( <i>laughter</i> )</p>

   <p>"Programmers should never have been given free will" - Obviously, Python. ( <i>laughter</i> )</p>

   <p>So my psychological conjecture is that normal people, if they perceive that a computer language is forcing them to learn theory, 
   they won't like it. In other words, hide the fancy stuff. It can be there, just hide it. <b>Fan Mail (14:42)</b></p>
   <dl>
      <dd>Q: "Dear Larry, I love Perl. It has saved my company, my crew, my sanity and my marriage. After Perl I can't imagine going 
      back to any other language. I dream in Perl, I tell everyone else about Perl. How can you improve on perfection? Signed, Happy 
      in Haifa."</dd>
   </dl>
   <dl>
      <dd>
      <dl>
         <dd>A: "Dear Happy,</dd>
         <dd>You need to recognize that Perl can be good in some dimensions and not so good in other dimensions. You also need to recognize 
         that there will be some pain in climbing over or tunneling through the barrier to the true minimum."</dd>
      </dl>
      </dd>
   </dl>

   <p>Now Perl 5 has a few false minima. Syntax, semantics, pragmatics, ( <i>laughter</i> ), discourse structure, implementation, documentation, 
   culture... Other than that Perl 5 is not too bad.</p>
   <dl>
      <dd>Q: "Dear Larry,</dd>
      <dd>You have often talked about the waterbed theory of linguistic complexity, and beauty times brains equals a constant. Isn't 
      it true that improving Perl in some areas will automatically make it worse in other areas? Signed, Terrified in Tel-Aviv."</dd>
   </dl>
   <dl>
      <dd>
      <dl>
         <dd>A: "Dear Terrified,</dd>
         <dd>...</dd>
         <dd>No." ( <i>laughter</i> )</dd>
      </dl>
      </dd>
   </dl>

   <p>You see, you can make some things so they aren't any worse. For instance, we changed all the sigils to be more consistent, and 
   they're just the same length, they're just different. And you can make some things much better. Instead of having to write all this 
   gobbledygook to dereference references in Perl 5 you can just do it straight left to right in Perl 6. Or there's even more shortcuts, 
   so multidimensional arrays and constant hash subscripts get their own notation, so it's even clearer, at least once you've learned 
   it. Again, we're optimizing for expressiveness, not necessarily learnability.</p>
   <dl>
      <dd>Q: "Dear Larry,</dd>
      <dd>I've heard a disturbing rumor that Perl 6 is turning into Java, or Python, or (whispered:) Ruby, or something. What's the 
      point of using Perl if it's just another object-oriented language? Why are we changing the arrow operator to the dot operator? 
      Signed, Nervous in Netanya."</dd>
   </dl>
   <dl>
      <dd>
      <dl>
         <dd>A: "Dear Nervous,</dd>
         <dd>First of all, we can do object orientation better without making other things worse. As I said. Now, we're changing from 
         arrow to dot, because ... because ... Well, just 'cuz I said so!"</dd>
      </dl>
      </dd>
   </dl>

   <p>You know, actually, we do have some good reasons - it's shorter, it's the industry standard, I wanted the arrow for something 
   else, and I wanted the dot as a secondary sigil. Now we can have it for attributes that have accessors. I also wanted the unary dot 
   for topical type calls, with an assumed object on the left and finally, because I said so. Darn it.</p>

   <p>... ... ...</p>

   <p><b>No arbitrary limits round two</b> : Perl started off with the idea that strings should grow infinitely, if you have memory. 
   Just let's get rid of those arbitrary limits that plagued Unix utilities in the early years. Perl 6 is taking this in a number of 
   different dimensions than just how long your strings are. No arbitrary limits - you ought to be able to program very abstractly, 
   you ought to be able to program very concretely - that's just one dimension.</p>

   <p>... .. ...</p>

   <p>Perl 5 is just all full of these strange gobbledygooky variables which we all know and love - and hate. So the error variables 
   are now unified into a single error variable. These variables have been deprecated forever, they're gone! These weird things that 
   just drive syntax highlighters nuts ( <i>laughter</i> ) now actually have more regular names. The star there, $*GID, that's what 
   we call a secondary sigil, what that just says is this is in the global namespace. So we know that that's a global variable for the 
   entire process. Similarly for uids.</p>

   <p>... ... ...</p>

   <p><em>Perl 5 had this problem with "do" loops because they weren't real loops - they were a "do" block followed by a statement modifier, 
   and people kept wanting to use loop control it them. Well, we can fix that. "loop" now is a real loop. And it allows a modifier on 
   it but still behaves as a real loop. And so, do goes off to have other duties, and you can write a loop that tests at the end and 
   it is a real loop. And this is just one of many many many things that confused new Perl 5 programmers.</em></p>

   <p>... ... ...</p>

   <p>Perl 5, another place where it was too orthogonal - we defined parameter passing to just come in as an array. You know arrays, 
   subroutines - they're just orthogonal. You just happen to have one called @_, which your parameters come in, and it was wonderfully 
   orthogonal, and people built all sorts of stuff on top of it, and it's another place where we are changing.</p>

   <p>... .. ...</p>
   Likewise, if you turn them inside out - the french quotes - you can use the regular angle brackets, and yes, we did change here-docs 
   so it does not conflict, then that's the equivalent of "qw". This qw interpolates, with single-angles it does not interpolate - that 
   is the exact "qw".

   <p><em>We have properties which you can put on variables and onto values. These are generalizations of things that were special code 
   in Perl 5, but now we have general mechanisms to do the same things, they're actually done using a mix-in mechanism like Ruby.</em></p>

   <p><em>Smart match operators is, like Damian say, equal-tilda ("=~") on steroids. Instead of just allowing a regular expression on the 
   right side it allows basically anything, and it figures out that this wants to do a numeric comparison, this wants to do a string 
   comparison, this wants to compare two arrays, this wants to do a lookup in the hash; this wants to call the closure on the right 
   passing in the left argument, and it will tell if you if $x can quack. Now that looks a little strange because you can just say "$x.can('quack')". 
   Why would you do it this way? Well, you'll see.</em></p>

   <p>... ... ..</p>

   <p>There's a lot of cruft that we inherited from the UNIX culture and we added more cruft, and we're cleaning it up. So in Perl 5 
   we made the mistake of interpreting regular expressions as strings, which means we had to do weird things like back-references are 
   \1 on the left, but they're $1 on the right, even though it means the same thing. In Perl 6, because it's just a language, (an embedded 
   language) $1 is the back-reference. It does not automatically interpolate this $1 from what it was before. You can also get it translated 
   to Euros I guess.</p>
   
<!--TAGS: . ~/Perl  -->

<!--file:///f:/Public_html/Scripting/Perlorama/History/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190921X_larry_wall_present_continuous_future_perfect_osdcisrael_wiki"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190921X_dr_dobb_s_journal_february_1998_a_conversation_with_larry_wall" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190921X_half_my_life_with_perl"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 21, 2019] <a target="_blank" href="http://www.ddj.com/articles/1998/9802/9802a/9802a.htm">Dr. Dobb's Journal February 1998 A   Conversation with Larry Wall</a></h4>

<h5>Perl is unique complex non-orthogonal language and due to this it has unique level of
  expressiveness.</h5>
<h5>Also the complexity of Perl to a large extent reflect the complexity of Perl environment
  (which is Unix environment at the beginning, but now also Windows environment with its
  quirks)</h5>
<h5>Notable quotes:</h5>
<h5>"...  On a syntactic level, in the particular case of Perl, I placed     variable names in a separate namespace from reserved words. That's one of the reasons there are     funny characters on the front of variable names -- dollar signs and so forth. That allowed me     to add new reserved words without breaking old programs. ..."</h5>
<h5>"...  A script is something that is easy to tweak, and a program is something that is locked     in. There are all sorts of metaphorical tie-ins that tend to make programs static and scripts     dynamic, but of course, it's a continuum. You can write Perl programs, and you can write C     scripts. People do talk more about Perl programs than C scripts. Maybe that just means Perl is     more versatile. ..."</h5>
<h5>"...  A good language actually gives you a range, a wide dynamic range, of your level of     discipline. We're starting to move in that direction with Perl. The initial Perl was     lackadaisical about requiring things to be defined or declared or what have you. Perl 5 has     some declarations that you can use if you want to increase your level of discipline. But it's     optional. So you can say "use strict," or you can turn on warnings, or you can do various sorts     of declarations. ..."</h5>
<h5>"...  But Perl was an experiment in trying to come     up with not a large language -- not as large as English -- but a medium-sized language, and to     try to see if, by adding certain kinds of complexity from natural language, the expressiveness     of the language grew faster than the pain of using it. And, by and large, I think that     experiment has been successful. ..."</h5>
<h5>"...  If you used the regular expression in a list context, it     will pass back a list of the various subexpressions that it matched. A different computer     language may add regular expressions, even have a module that's called Perl 5 regular     expressions, but it won't be integrated into the language. You'll have to jump through an extra     hoop, take that right angle turn, in order to say, "Okay, well here, now apply the regular     expression, now let's pull the things out of the regular expression," rather than being able to     use the thing in a particular context and have it do something meaningful. ..."</h5>
<h5>"...  A language is not a set of syntax     rules. It is not just a set of semantics. It's the entire culture surrounding the language     itself. So part of the cultural context in which you analyze a language includes all the     personalities and people involved -- how everybody sees the language, how they propagate the     language to other people, how it gets taught, the attitudes of people who are helping each     other learn the language -- all of this goes into the pot of context. ..."</h5>
<h5>"...  In the beginning, I just tried to help everybody. Particularly being on     USENET. You know, there are even some sneaky things in there -- like looking for people's Perl     questions in many different newsgroups. For a long time, I resisted creating a newsgroup for     Perl, specifically because I did not want it to be ghettoized. You know, if someone can say,     "Oh, this is a discussion about Perl, take it over to the Perl newsgroup," then they shut off     the discussion in the shell newsgroup. If there are only the shell newsgroups, and someone     says, "Oh, by the way, in Perl, you can solve it like this," that's free advertising. So, it's     fuzzy. We had proposed Perl as a newsgroup probably a year or two before we actually created     it. It eventually came to the point where the time was right for it, and we did that. ..."</h5>
<h5>"...  For most web applications, Perl is severely underutilized. Your typical CGI script says     print, print, print, print, print, print, print. But in a sense, it's the dynamic range of Perl     that allows for that. You don't have to say a whole lot to write a simple Perl script, whereas     your minimal Java program is, you know, eight or ten lines long anyway. Many of the features     that made it competitive in the UNIX space will make it competitive in other spaces. ..."</h5>
<h5>"...  Over the years, much of the work of making Perl work for people has been in designing     ways for people to come to Perl. I actually delayed the first version of Perl for a couple of     months until I had a sed-to-Perl and an awk-to-Perl translator. One of the benefits of     borrowing features from various other languages is that those subsets of Perl that use those     features are familiar to people coming from that other culture. What would be best, in my book,     is if someone had a way of saying, "Well, I've got this thing in Visual Basic. Now, can I just     rewrite some of these things in Perl?" ..."</h5>
<blockquote>
<h6>Feb 28, 1998 |  <a target="_blank" href= "http://www.ddj.com/articles/1998/9802/9802a/9802a.htm">www.ddj.com</a></h6>
 
 

    <p>... ... ...</p>

    <p><i><b>The creator of Perl talks about language design and Perl. By Eugene Eric
    Kim</b></i></p>

    <p><b><i>DDJ</i> : Is Perl 5.005 what you envisioned Perl to be when you set out to do
    it?</b></p>

    <p><b>LW:</b> That assumes that I'm smart enough to envision something as complicated as Perl.
    I knew that Perl would be good at some things, and would be good at more things as time went
    on. So, in a sense, I'm sort of blessed with natural stupidity -- as opposed to artificial
    intelligence -- in the sense that I know what my intellectual limits are.</p>

    <p>I'm not one of these people who can sit down and design an entire system from scratch and
    figure out how everything relates to everything else, so I knew from the start that I had to
    take the bear-of-very-little-brain approach, and design the thing to evolve. But that fit in
    with my background in linguistics, because natural languages evolve over time.</p>

    <p>You can apply biological metaphors to languages. They move into niches, and as new needs
    arise, languages change over time. It's actually a practical way to design a computer language.
    Not all computer programs can be designed that way, but I think more can be designed that way
    than have been. A lot of the majestic failures that have occurred in computer science have been
    because people thought they could design the whole thing in advance.</p>

    <p><b><i>DDJ</i> : How do you design a language to evolve?</b></p>

    <p><b>LW:</b> There are several aspects to that, depending on whether you are talking about
    syntax or semantics. <em>On a syntactic level, in the particular case of Perl, I placed
    variable names in a separate namespace from reserved words. That's one of the reasons there are
    funny characters on the front of variable names -- dollar signs and so forth. That allowed me
    to add new reserved words without breaking old programs.</em></p>

    <p><b><i>DDJ</i> : What is a scripting language? Does Perl fall into the category of a
    scripting language?</b></p>

    <p><b>LW:</b> Well, being a linguist, I tend to go back to the etymological meanings of
    "script" and "program," though, of course, that's fallacious in terms of what they mean
    nowadays. A script is what you hand to the actors, and a program is what you hand to the
    audience. Now hopefully, the program is already locked in by the time you hand that out,
    whereas the script is something you can tinker with. I think of phrases like "following the
    script," or "breaking from the script." The notion that you can evolve your script ties into
    the notion of rapid prototyping.</p>

    <p><em>A script is something that is easy to tweak, and a program is something that is locked
    in. There are all sorts of metaphorical tie-ins that tend to make programs static and scripts
    dynamic, but of course, it's a continuum. You can write Perl programs, and you can write C
    scripts. People do talk more about Perl programs than C scripts. Maybe that just means Perl is
    more versatile.</em></p>

    <p>... ... ...</p>

    <p><b><i>DDJ</i> : Would that be a better distinction than interpreted versus compiled --
    run-time versus compile-time binding?</b></p>

    <p><b>LW:</b> It's a more useful distinction in many ways because, with late-binding languages
    like Perl or Java, you cannot make up your mind about what the real meaning of it is until the
    last moment. But there are different definitions of what the last moment is. Computer
    scientists would say there are really different "latenesses" of binding.</p>

    <p><em>A good language actually gives you a range, a wide dynamic range, of your level of
    discipline. We're starting to move in that direction with Perl. The initial Perl was
    lackadaisical about requiring things to be defined or declared or what have you. Perl 5 has
    some declarations that you can use if you want to increase your level of discipline. But it's
    optional. So you can say "use strict," or you can turn on warnings, or you can do various sorts
    of declarations.</em></p>

    <p><b><i>DDJ</i> : Would it be accurate to say that Perl doesn't enforce good design?</b></p>

    <p>LW: No, it does not. It tries to give you some tools to help if you want to do that, but I'm
    a firm believer that a language -- whether it's a natural language or a computer language --
    ought to be an amoral artistic medium.</p>

    <p>You can write pretty poems or you can write ugly poems, but that doesn't say whether English
    is pretty or ugly. So, while I kind of like to see beautiful computer programs, I don't think
    the chief virtue of a language is beauty. That's like asking an artist whether they use
    beautiful paints and a beautiful canvas and a beautiful palette. A language should be a medium
    of expression, which does not restrict your feeling unless you ask it to.</p>

    <p><b><i>DDJ</i> : Where does the beauty of a program lie? In the underlying algorithms, in the
    syntax of the description?</b></p>

    <p><b>LW:</b> Well, there are many different definitions of artistic beauty. It can be argued
    that it's symmetry, which in a computer language might be considered orthogonality. It's also
    been argued that broken symmetry is what is considered most beautiful and most artistic and
    diverse. Symmetry breaking is the root of our whole universe according to physicists, so if God
    is an artist, then maybe that's his definition of what beauty is.</p>

    <p>This actually ties back in with the built-to-evolve concept on the semantic level. A lot of
    computer languages were defined to be naturally orthogonal, or at least the computer scientists
    who designed them were giving lip service to orthogonality. And that's all very well if you're
    trying to define a position in a space. But that's not how people think. It's not how natural
    languages work. Natural languages are not orthogonal, they're diagonal. They give you
    hypotenuses.</p>

    <p>Suppose you're flying from California to Quebec. You don't fly due east, and take a left
    turn over Nashville, and then go due north. You fly straight, more or less, from here to there.
    And it's a network. And it's actually sort of a fractal network, where your big link is
    straight, and you have little "fractally" things at the end for your taxi and bicycle and
    whatever the mode of transport you use. Languages work the same way. And they're designed to
    get you most of the way here, and then have ways of refining the additional shades of
    meaning.</p>

    <p>When they first built the University of California at Irvine campus, they just put the
    buildings in. They did not put any sidewalks, they just planted grass. The next year, they came
    back and built the sidewalks where the trails were in the grass. Perl is that kind of a
    language. It is not designed from first principles. Perl is those sidewalks in the grass. Those
    trails that were there before were the previous computer languages that Perl has borrowed ideas
    from. And Perl has unashamedly borrowed ideas from many, many different languages. Those paths
    can go diagonally. We want shortcuts. Sometimes we want to be able to do the orthogonal thing,
    so Perl generally allows the orthogonal approach also. But it also allows a certain number of
    shortcuts, and being able to insert those shortcuts is part of that evolutionary thing.</p>

    <p>I don't want to claim that this is the only way to design a computer language, or that
    everyone is going to actually enjoy a computer language that is designed in this way.
    Obviously, some people speak other languages. <em>But Perl was an experiment in trying to come
    up with not a large language -- not as large as English -- but a medium-sized language, and to
    try to see if, by adding certain kinds of complexity from natural language, the expressiveness
    of the language grew faster than the pain of using it. And, by and large, I think that
    experiment has been successful.</em></p>

    <p><b><i>DDJ</i> : Give an example of one of the things you think is expressive about Perl that
    you wouldn't find in other languages.</b></p>

    <p><b>LW:</b> The fact that regular-expression parsing and the use of regular expressions is
    built right into the language. <em>If you used the regular expression in a list context, it
    will pass back a list of the various subexpressions that it matched. A different computer
    language may add regular expressions, even have a module that's called Perl 5 regular
    expressions, but it won't be integrated into the language. You'll have to jump through an extra
    hoop, take that right angle turn, in order to say, "Okay, well here, now apply the regular
    expression, now let's pull the things out of the regular expression," rather than being able to
    use the thing in a particular context and have it do something meaningful.</em></p>

    <p>The school of linguistics I happened to come up through is called tagmemics, and it makes a
    big deal about context. In a real language -- this is a tagmemic idea -- you can distinguish
    between what the conventional meaning of the "thing" is and how it's being used. You think of
    "dog" primarily as a noun, but you can use it as a verb. That's the prototypical example, but
    the "thing" applies at many different levels. You think of a sentence as a sentence.
    Transformational grammar was built on the notion of analyzing a sentence. And they had all
    their cute rules, and they eventually ended up throwing most of them back out again.</p>

    <p>But in the tagmemic view, you can take a sentence as a unit and use it differently. You can
    say a sentence like, "I don't like your I-can-use-anything-like-a-sentence attitude." There,
    I've used the sentence as an adjective. The sentence isn't an adjective if you analyze it, any
    way you want to analyze it. But this is the way people think. If there's a way to make sense of
    something in a particular context, they'll do so. And Perl is just trying to make those things
    make sense. There's the basic distinction in Perl between singular and plural context -- call
    it list context and scalar context, if you will. But you can use a particular construct in a
    singular context that has one meaning that sort of makes sense using the list context, and it
    may have a different meaning that makes sense in the plural context.</p>

    <p>That is where the expressiveness comes from. In English, you read essays by people who say,
    "Well, how does this metaphor thing work?" Owen Barfield talks about this. You say one thing
    and mean another. That's how metaphors arise. Or you take two things and jam them together. I
    think it was Owen Barfield, or maybe it was C.S. Lewis, who talked about "a piercing
    sweetness." And we know what "piercing" is, and we know what "sweetness" is, but you put those
    two together, and you've created a new meaning. And that's how languages ought to work.</p>

    <p><b><i>DDJ</i> : Is a more expressive language more difficult to learn?</b></p>

    <p><b>LW:</b> Yes. It was a conscious tradeoff at the beginning of Perl that it would be more
    difficult to master the whole language. However, taking another clue from a natural language,
    we do not require 5-year olds to speak with the same diction as 50-year olds. It is okay for
    you to use the subset of a language that you are comfortable with, and to learn as you go. This
    is not true of so many computer-science languages. If you program C++ in a subset that
    corresponds to C, you get laughed out of the office.</p>

    <p>There's a whole subject that we haven't touched here. <em>A language is not a set of syntax
    rules. It is not just a set of semantics. It's the entire culture surrounding the language
    itself. So part of the cultural context in which you analyze a language includes all the
    personalities and people involved -- how everybody sees the language, how they propagate the
    language to other people, how it gets taught, the attitudes of people who are helping each
    other learn the language -- all of this goes into the pot of context.</em></p>

    <p>Because I had already put out other freeware projects (rn and patch), I realized before I
    ever wrote Perl that a great deal of the value of those things was from collaboration. Many of
    the really good ideas in rn and Perl came from other people.</p>

    <p>I think that Perl is in its adolescence right now. There are places where it is grown up,
    and places where it's still throwing tantrums. I have a couple of teenagers, and the thing you
    notice about teenagers is that they're always plus or minus ten years from their real age. So
    if you've got a 15-year old, they're either acting 25 or they're acting 5. Sometimes
    simultaneously! And Perl is a little that way, but that's okay.</p>

    <p><b><i>DDJ</i> : What part of Perl isn't quite grown up?</b></p>

    <p><b>LW:</b> Well, I think that the part of Perl, which has not been realistic up until now
    has been on the order of how you enable people in certain business situations to actually use
    it properly. There are a lot of people who cannot use freeware because it is, you know,
    schlocky. Their bosses won't let them, their government won't let them, or they think their
    government won't let them. There are a lot of people who, unknown to their bosses or their
    government, are using Perl.</p>

    <p><b><i>DDJ</i> : So these aren't technical issues.</b></p>

    <p><b>LW:</b> I suppose it depends on how you define technology. Some of it is perceptions,
    some of it is business models, and things like that. I'm trying to generate a new symbiosis
    between the commercial and the freeware interests. I think there's an artificial dividing line
    between those groups and that they could be more collaborative.</p>

    <p>As a linguist, the generation of a linguistic culture is a technical issue. So, these
    adjustments we might make in people's attitudes toward commercial operations or in how Perl is
    being supported, distributed, advertised, and marketed -- not in terms of trying to make bucks,
    but just how we propagate the culture -- these are technical ideas in the psychological and the
    linguistic sense. They are, of course, not technical in the computer-science sense. But I think
    that's where Perl has really excelled -- its growth has not been driven solely by technical
    merits.</p>

    <p><b><i>DDJ</i> : What are the things that you do when you set out to create a culture around
    the software that you write?</b></p>

    <p><b>LW:</b> <em>In the beginning, I just tried to help everybody. Particularly being on
    USENET. You know, there are even some sneaky things in there -- like looking for people's Perl
    questions in many different newsgroups. For a long time, I resisted creating a newsgroup for
    Perl, specifically because I did not want it to be ghettoized. You know, if someone can say,
    "Oh, this is a discussion about Perl, take it over to the Perl newsgroup," then they shut off
    the discussion in the shell newsgroup. If there are only the shell newsgroups, and someone
    says, "Oh, by the way, in Perl, you can solve it like this," that's free advertising. So, it's
    fuzzy. We had proposed Perl as a newsgroup probably a year or two before we actually created
    it. It eventually came to the point where the time was right for it, and we did that.</em></p>

    <p><b><i>DDJ</i> : Perl has really been pigeonholed as a language of the Web. One result is
    that people mistakenly try to compare Perl to Java. Why do you think people make the comparison
    in the first place? Is there anything to compare?</b></p>

    <p><b>LW:</b> Well, people always compare everything.</p>

    <p><b><i>DDJ</i> : Do you agree that Perl has been pigeonholed?</b></p>

    <p><b>LW:</b> Yes, but I'm not sure that it bothers me. Before it was pigeonholed as a web
    language, it was pigeonholed as a system-administration language, and I think that -- this goes
    counter to what I was saying earlier about marketing Perl -- if the abilities are there to do a
    particular job, there will be somebody there to apply it, generally speaking. So I'm not too
    worried about Perl moving into new ecological niches, as long as it has the capability of
    surviving in there.</p>

    <p>Perl is actually a scrappy language for surviving in a particular ecological niche. (Can you
    tell I like biological metaphors?) You've got to understand that it first went up against C and
    against shell, both of which were much loved in the UNIX community, and it succeeded against
    them. So that early competition actually makes it quite a fit competitor in many other realms,
    too.</p>

    <p><em>For most web applications, Perl is severely underutilized. Your typical CGI script says
    print, print, print, print, print, print, print. But in a sense, it's the dynamic range of Perl
    that allows for that. You don't have to say a whole lot to write a simple Perl script, whereas
    your minimal Java program is, you know, eight or ten lines long anyway. Many of the features
    that made it competitive in the UNIX space will make it competitive in other spaces.</em></p>

    <p>Now, there are things that Perl can't do. One of the things that you can't do with Perl
    right now is compile it down to Java bytecode. And if that, in the long run, becomes a large
    ecological niche (and this is not yet a sure thing), then that is a capability I want to be
    certain that Perl has.</p>

    <p><b><i>DDJ</i> : There's been a movement to merge the two development paths between the
    ActiveWare Perl for Windows and the main distribution of Perl. You were talking about
    ecological niches earlier, and how Perl started off as a text-processing language. The
    scripting languages that are dominant on the Microsoft platforms -- like VB -- tend to be more
    visual than textual. Given Perl's UNIX origins -- awk, sed, and C, for that matter -- do you
    think that Perl, as it currently stands, has the tools to fit into a Windows niche?</b></p>

    <p><b>LW:</b> Yes and no. It depends on your problem domain and who's trying to solve the
    problem. There are problems that only need a textual solution or don't need a visual solution.
    Automation things of certain sorts don't need to interact with the desktop, so for those sorts
    of things -- and for the programmers who aren't really all that interested in visual
    programming -- it's already good for that. And people are already using it for that. Certainly,
    there is a group of people who would be enabled to use Perl if it had more of a visual
    interface, and one of the things we're talking about doing for the O'Reilly NT Perl Resource
    Kit is some sort of a visual interface.</p>

    <p>A lot of what Windows is designed to do is to get mere mortals from 0 to 60, and there are
    some people who want to get from 60 to 100. We are not really interested in being in
    Microsoft's crosshairs. We're not actually interested in competing head-to-head with Visual
    Basic, and to the extent that we do compete with them, it's going to be kind of subtle. There
    has to be some way to get people from the slow lane to the fast lane. It's one thing to give
    them a way to get from 60 to 100, but if they have to spin out to get from the slow lane to the
    fast lane, then that's not going to work either.</p>

    <p><em>Over the years, much of the work of making Perl work for people has been in designing
    ways for people to come to Perl. I actually delayed the first version of Perl for a couple of
    months until I had a sed-to-Perl and an awk-to-Perl translator. One of the benefits of
    borrowing features from various other languages is that those subsets of Perl that use those
    features are familiar to people coming from that other culture. What would be best, in my book,
    is if someone had a way of saying, "Well, I've got this thing in Visual Basic. Now, can I just
    rewrite some of these things in Perl?"</em></p>

    <p>We're already doing this with Java. On our UNIX Perl Resource Kit, I've got a hybrid
    language called "jpl" -- that's partly a pun on my old alma mater, Jet Propulsion Laboratory,
    and partly for Java, Perl...Lingo, there we go! That's good. "Java Perl Lingo." You've heard it
    first here! jpl lets you take a Java program and magically turn one of the methods into a chunk
    of Perl right there inline. It turns Perl code into a native method, and automates the linkage
    so that when you pull in the Java code, it also pulls in the Perl code, and the interpreter,
    and everything else. It's actually calling out from Java's Virtual Machine into Perl's virtual
    machine. And we can call in the other direction, too. You can embed Java in Perl, except that
    there's a bug in JDK having to do with threads that prevents us from doing any I/O. But that's
    Java's problem.</p>

    <p>It's a way of letting somebody evolve from a purely Java solution into, at least partly, a
    Perl solution. It's important not only to make Perl evolve, but to make it so that people can
    evolve their own programs. It's how I program, and I think a lot of people program that way.
    Most of us are too stupid to know what we want at the beginning.</p>

    <p><b><i>DDJ</i> : Is there hope down the line to present Perl to a standardization
    body?</b></p>

    <p><b>LW:</b> Well, I have said in jest that people will be free to standardize Perl when I'm
    dead. There may come a time when that is the right thing to do, but it doesn't seem appropriate
    yet.</p>

    <p><b><i>DDJ</i> : When would that time be?</b></p>

    <p><b>LW:</b> Oh, maybe when the federal government declares that we can't export Perl unless
    it's standardized or something.</p>

    <p><b><i>DDJ</i> : Only when you're forced to, basically.</b></p>

    <p><b>LW:</b> Yeah. To me, once things get to a standards body, it's not very interesting
    anymore. The most efficient form of government is a benevolent dictatorship. I remember walking
    into some BOF that USENIX held six or seven years ago, and John Quarterman was running it, and
    he saw me sneak in, sit in the back corner, and he said, "Oh, here comes Larry Wall! He's a
    standards committee all of his own!"</p>

    <p>A great deal of the success of Perl so far has been based on some of my own idiosyncrasies.
    And I recognize that they are idiosyncrasies, and I try to let people argue me out of them
    whenever appropriate. But there are still ways of looking at things that I seem to do
    differently than anybody else. It may well be that perl5-porters will one day degenerate into a
    standards committee. So far, I have not abused my authority to the point that people have
    written me off, and so I am still allowed to exercise a certain amount of absolute power over
    the Perl core.</p>

    <p>I just think headless standards committees tend to reduce everything to mush. There is a
    conservatism that committees have that individuals don't, and there are times when you want to
    have that conservatism and times you don't. I try to exercise my authority where we don't want
    that conservatism. And I try not to exercise it at other times.</p>

    <p><b><i>DDJ</i> : How did you get involved in computer science? You're a linguist by
    background?</b></p>

    <p><b>LW:</b> Because I talk to computer scientists more than I talk to linguists, I wear the
    linguistics mantle more than I wear the computer-science mantle, but they actually came along
    in parallel, and I'm probably a 50/50 hybrid. You know, basically, I'm no good at either
    linguistics or computer science.</p>

    <p><b><i>DDJ</i> : So you took computer-science courses in college?</b></p>

    <p><b>LW:</b> In college, yeah. In college, I had various majors, but what I eventually
    graduated in -- I'm one of those people that packed four years into eight -- what I eventually
    graduated in was a self-constructed major, and it was Natural and Artificial Languages, which
    seems positively prescient considering where I ended up.</p>

    <p><b><i>DDJ</i> : When did you join O'Reilly as a salaried employee? And how did that come
    about?</b></p>

    <p><b>LW:</b> A year-and-a-half ago. It was partly because my previous job was kind of winding
    down.</p>

    <p><b><i>DDJ</i> : What was your previous job?</b></p>

    <p><b>LW:</b> I was working for Seagate Software. They were shutting down that branch of
    operations there. So, I was just starting to look around a little bit, and Tim noticed me
    looking around and said, "Well, you know, I've wanted to hire you for a long time," so we
    talked. And Gina Blaber (O'Reilly's software director) and I met. So, they more or less offered
    to pay me to mess around with Perl.</p>

    <p>So it's sort of my dream job. I get to work from home, and if I feel like taking a nap in
    the afternoon, I can take a nap in the afternoon and work all night.</p>

    <p><b><i>DDJ</i> : Do you have any final comments, or tips for aspiring programmers? Or
    aspiring Perl programmers?</b></p>

    <p><b>LW:</b> Assume that your first idea is wrong, and try to think through the various
    options. I think that the biggest mistake people make is latching onto the first idea that
    comes to them and trying to do that. It really comes to a thing that my folks taught me about
    money. Don't buy something unless you've wanted it three times. Similarly, don't throw in a
    feature when you first think of it. Think if there's a way to generalize it, think if it should
    be generalized. Sometimes you can generalize things too much. I think like the things in Scheme
    were generalized too much. There is a level of abstraction beyond which people don't want to
    go. Take a good look at what you want to do, and try to come up with the long-term lazy way,
    not the short-term lazy way.</p>
    
 
<!--TAGS: . ~/Lang ~/History -->
 <!--file:///f:/Public_html/Scripting/Perlorama/History/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Lang/index.shtml-->
<!--file:///f:/Public_html/History/index.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Neoliberalism/History/index.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190921X_dr_dobb_s_journal_february_1998_a_conversation_with_larry_wall"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190921X_half_my_life_with_perl" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190921X_how_did_perl_lose_ground_to_bash"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 21, 2019] <a target="_blank" href="https://www.socallinuxexpo.org/scale12x-supporting/default/files/presentations/my%20half%20life%20with%20Perl.pdf"> Half my life with Perl</a> by Randal L. Schwartz</h4>

<blockquote>
<h6>Sep 21, 2019 |  <a target="_blank" href="https://www.socallinuxexpo.org/scale12x-supporting/default/files/presentations/my%20half%20life%20with%20Perl.pdf"> www.socallinuxexpo.org</a></h6>
 

   <p><b>... ... ... </b></p>

   <p><b>Derailed to an unexpectedly good outcome</b></p>
   <ul>

      <li>Contract coding ($30/hr in 1977 -- about $120/hr today) at age 15<p></p>
      </li>

      <li>Out of high school at age 16<p></p>
      </li>

      <li>Got a summer temp job at Tektronix (largest employer in state)<blockquote>

         <li>- ... as a tech writer</li>
      </blockquote>
      </li>

      <li>Learned writing on the job<blockquote>

         <li>- Organization (book and company) from Lyle Settle</li>

         <li>- Tech editing from Jack Falk</li>
      </blockquote>
      </li>

      <li>Stayed in that slot for four years<blockquote>

         <li>- Migrated from temp to salaried position quickly (youngest salaried, highest paid minor)</li>
      </blockquote>
      </li>

      <li>Then a year as a programmer<blockquote>

         <li>- Realized not really different... expressing an art into a medium. Oh, and meetings.</li>
      </blockquote>
      </li>
   </ul>
   <hr>

   <p><b>Larry Wall</b></p>
   <ul>

      <li>rn<ul>

         <li>- Started on Usenet in 1981</li>

         <li>- Used that as my primary news reader for many years</li>

         <li>- Until Tek sysadmins "nice'd" it</li>

         <li>- Been reading Usenet with GNU Emacs (GNEWS, then GNUS) since then</li>

         <li>- Really enjoyed the very readable manpage</li>
      </ul>
      </li>

      <li>patch</li>

      <li>perl </li>
   </ul>
   <hr>

   <p><b>Perl 1</b></p>
   <blockquote>
      <ul>

         <li>§ Released in 1987</li>

         <li>§ Downloaded, compiled, played with a bit</li>

         <li>- Interesting to do, since it was quite a number of separate postings</li>

         <li>- Might have been the first “sharchive”</li>

         <li>§ Looked like a “super Awk” to me</li>

         <li>§ And I was already pretty good at Awk</li>
      </ul>
   </blockquote>
   <hr>

   <p><b>Perl 2</b></p>
   <ul>

      <li>Released in 1988</li>

      <li>A lot more complete</li>

      <li>My go-to language for new tools</li>

      <li>Also started rewriting many of my shell scripts<ul>

         <li>- And my GNU Emacs Lisp utilities</li>
      </ul>
      </li>
   </ul>
   <hr>

   <p><b>Trolling Usenet</b></p>
   <ul>

      <li>Spread the perl word in comp.unix.questions and comp.unix.shell</li>

      <li>Answered as many questions as I could in Perl</li>

      <li>Inevitably...<p>- "Would someone be kind enough to provide me with a script (sed? awk? no perl please) that I could run on several hundred files?"</p>
      </li>

      <li>So I'd show<p>- The shell solution</p>

      <p>- The much shorter (and likely faster) Perl solution</p>
      </li>

      <li>Recruited a lot of early Perl adopters this way</li>
   </ul>
   
   <p>... ... ...</p>
   <hr>

   <p><b>Birth of a camel</b></p>
<ul>
   <li>Perl2 manpage is 20 pages; Perl3 is 60 pages</li>

   <li>"We need more documentation"</li>

   <li>Larry says "ok, when I get some spare time"</li>

   <li>I chimed in "I can help, being tech-writer and also on alpha team"</li>

   <li>O'Reilly IT person ("ambar") saw that...<p>- "If you're gonna write something, we might as well publish it"</p>
   </li>

   <li>Wrote Larry and suggested "Pe(a)rls of Wisdom" (or was it the other way around?)<p>- Thank goodness he pushed back on that :)</p>
   </li>

   <li>We met face-to-face (Carrows in Salem), and decided we could work together<p>- Sonny Malone: I don't know the first thing about being a partner</p>

   <p>Danny McGuire: It's easy. We share the responsibilities and we argue a lot. It's like being</p>

   <p>married... without the good part</p>

   <p>-- <i>Xanadu</i></p>
   </ul>
   <hr>

   <p><b>Writing the camel</b></p>
<ul>
   <li>Written in TROFF, with which I was quite experienced (production at Tek 8 years earlier)<p></p>
   </li>

   <li>The "in-house" O'Reilly TROFF macros looked hauntingly familiar<p></p>

   <p>- ... because I had written them!</p>

   <p>- Steve Talbott took my Tek macros to Tim O'Reilly, and used on nearly every book of theirs</p>
   </li>

   <li>No change control -- book written entirely by email. UUCP-based email.<p></p>
   </li>

   <li>I created the book design based on what I had learned from Lyle<p></p>

   <p>- And suggested the humorous index entries</p>
   </li>

   <li>I also invented "Perl = the language, perl = the interpreter"<p></p>
   </li>

   <li>Six months of nights and weekends<p></p>
   </li>

   <li>Larry decided the book would describe "Perl 4" (by bumping 3.044 to 4.000 at release)<p></p>

   <p>- In the preface I said "but it might be 4.003 because of changes after we submit the book"</p>

   <p>- I was right. :)</p>
   </ul>
   <hr>

   <p><b>Release the camel!</b></p>
   <ul>

   <li>Larry and I met for the second time at the Usenix conference in Dallas (early 1991)<p>- Shared a room at the hotel ("Do you know a 'Larry Wall'?")</p>
   </li>

   <li>Signed many dozens (hundreds?) of copies<p>- Larry started using his special Camel stamp</p>
   </li>

   <li>Runaway best seller<p>- Tim had to rethink high volume press</p>

   <p>- We ran through a typical year's print in just the first two months</p>
   </li>

   <li>People wrote me thanking me for "finally being able to use Perl officially"<p>- Darn PHBs not trusting things without printed docs</p>
   </ul>
   <hr>
   
  <!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/Perlorama/History/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
</blockquote>


</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190921X_half_my_life_with_perl"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190921X_how_did_perl_lose_ground_to_bash" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190919X_min_and_max_functions_in_perl"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 21, 2019] <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/">How Did  Perl Lose Ground to Bash?</a></h4>

<h5>Notable quotes:</h5>
<h5>"...  It baffles me the most because the common objection to Perl is legibility. Even if you assume that the objection is made        from ignorance - i.e. not even having looked at some Perl to gauge its legibility - the nonsense you see in a complex bash script        is orders of magnitude worse! ..."</h5>
<h5>"...  Maybe it's not reassuring to hear that, but I took an interest in Perl precisely because it's seen as an underdog and "dead"        despite having experienced users and a lot of code, kind of like TCL, Prolog, or Ada. ..."</h5>
<h5>"...  There's a long history of bad code written by mediocre developers who became the only one who could maintain the codebase        until they no longer worked for the organization. The next poor sap to go in found a mess of a codebase and did their best to        not break it further. After a few iterations, the whole thing is ready for /dev/null and Perl gets the blame. ..."</h5>
<h5>"...  All in all, Perl is still my first go-to language, but there are definitely some things I wish it did better.  ..."</h5>
<h5>"...  The Perl leadership Osborned itself with Perl6. 20/20 hindsight says the new project should have been given a different        name at conception, that way all the "watch this space -- under construction" signage wouldn't have steered people away from perfectly        usable Perl5. Again, IMO. ..."</h5>
<h5>"...  I don't observe the premise at all though. Is bash really gaining ground over anything recently? ..."</h5>
<h5>"...  Python again is loved, because "taught by rote" idiots. Now you can give them pretty little packages. And it's no wonder        they can do little better than be glorified system admins (which id rather have a real sys admin, since he's likely to understand        Perl) ..."</h5>
<h5>"...  Making a new language means lots of new training. Lots of profit in this. Nobody profits from writing new books on old        languages. Lots of profit in general from supporting a new language. In the end, owning the language gets you profits. ..."</h5>
<h5>"...  And I still don't get why tab for blocks python is even remotely more readable than Perl. ..."</h5>
<h5>"...  If anything, JavaScript is pretty dang godly at what it does, I understand why that's popular. But I don't get python one        bit, except to employ millions of entry level minions who can't think on their own. ..."</h5>
<h5>"...  "Every teacher I know has students using it. We do it because it's an easy language, there's only one way to do it, and        with whitespace as syntax it's easy to grade. We don't teach it because it is some powerful or exceptional language. " ..."</h5>
<blockquote>
<h6>Sep 21, 2019 |  <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/">www.reddit.com</a></h6>
 

   <p><b>How Did Perl Lose Ground to Bash?</b>
   <img alt="" src="https://www.redditstatic.com/desktop2x/img/renderTimingPixel.png" onload="(__markFirstPostVisible || function(){})();"></p>

   <p>Setting aside Perl vs. Python for the moment, how did Perl lose ground to Bash? It used to be that Bash scripts often got replaced 
   by Perl scripts because Perl was more powerful. Even with very modern versions of Bash, Perl is much more powerful.</p>

   <p>The Linux Standards Base (LSB) has helped ensure that certain tools are in predictable locations. Bash has gotten a bit more powerful 
   since the release of 4.x, sure. Arrays, handicapped to 2-D arrays, have improved somewhat. There is a native regex engine in Bash 
   3.x, which admit is a big deal. There is also support for hash maps.</p>

   <p>This is all good stuff for Bash. But, none of this is sufficient to explain why Perl isn't the thing you learn after Bash, or, 
   after Bash and Python; take your pick. Thoughts? </p>

   <p><a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/">28 comments</a> 75% 
   Upvoted What are your thoughts? Log in or Sign up
   <a target="_blank" href="https://www.reddit.com/login?dest=https%3A%2F%2Fwww.reddit.com%2Fr%2Fperl%2Fcomments%2Fd2yix0%2Fhow_did_perl_lose_ground_to_bash%2F">
   log in</a>
   <a target="_blank" href="https://www.reddit.com/register?dest=https%3A%2F%2Fwww.reddit.com%2Fr%2Fperl%2Fcomments%2Fd2yix0%2Fhow_did_perl_lose_ground_to_bash%2F">
   sign up</a> Sort by </p>

   <p><a target="_blank" href="https://www.reddit.com/user/oldmanwillow21/">oldmanwillow21</a> 9 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/ezxmesp/">9 days ago</a></p>
   <blockquote>

      <p>Because Perl has suffered immensely in the popularity arena and is now viewed as undesirable. It's not that Bash is seen as 
      an adequate replacement for Perl, that's where Python has landed. </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/emilper/">emilper</a> 8 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/ezz3o3l/">8 days ago</a></p>
   <blockquote>

      <p>How did Perl5 lose ground to anything else?</p>

      <p>Thusly</p>

      <p>- "thou must use Moose for everything" -> "Perl is too slow" -> rewrite in Python because the architect loves Python -> Python 
      is even slower -> architect shunned by the team and everything new written in Go, nobody dares to complain about speed now because 
      the budget people don't trust them -> Perl is slow</p>

      <p>- "globals are bad, singletons are good" -> spaghetti -> Perl is unreadable</p>

      <p>- "lets use every single item from the gang of four book" -> insanity -> Perl is bad</p>

      <p>- "we must be more OOP" -> everything is a faux object with everything else as attributes -> maintenance team quits and they 
      all take PHP jobs, at least the PHP people know their place in the order of things and do less hype-driven-development -> Perl 
      is not OOP enough</p>

      <p>- "CGI is bad" -> app needs 6.54GB of RAM for one worker -> customer refuses to pay for more RAM, fires the team, picks a PHP 
      team to do the next version -> PHP team laughs all the way to the bank, chanting "CGI is king" </p>

      <p><a target="_blank" href="https://www.reddit.com/user/recrof/">recrof</a> 2 points ·
      <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/f008qq9/">8 days ago</a></p>

      <p>"CGI is bad" is real. PSGI or FCGI is much faster for web services, and if there are memory leaks, it's always possible to 
      debug & fix them. </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/Grinnz/">Grinnz</a> 6 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/f00myfk/">8 days ago</a></p>
   <blockquote>

      <p>CGI is fine, when it's all you need. There are many different use cases out there. Just
      <a target="_blank" href="http://blogs.perl.org/users/grinnz/2018/11/modern-perl-cgi.html">don't use CGI.pm</a> . </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/emilper/">emilper</a> 2 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/f03qx8b/">7 days ago</a></p>
   <blockquote>
      <blockquote>

         <p>memory leaks</p>
      </blockquote>

      <p>memory leaks ... do huge monoliths count as "memory leaks" ? </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/Altreus/">Altreus</a> 7 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/ezzxfwg/">8 days ago</a></p>
   <blockquote>

      <p><em>It baffles me the most because the common objection to Perl is legibility. Even if you assume that the objection is made 
      from ignorance - i.e. not even having looked at some Perl to gauge its legibility - the nonsense you see in a complex bash script 
      is orders of magnitude worse!</em></p>

      <p>Not to mention its total lack of common language features like first-class data and... Like, a compiler...</p>

      <p>I no longer write bash scripts because it takes about 5 lines to become unmaintainable. </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/crashorbit/">crashorbit</a> 5 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/ezxt02z/">9 days ago</a></p>
   <blockquote>

      <p>Every language that reaches functional equity with Perl is perceived as better than it. Mostly because hey, at least it's not 
      Perl. </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/oldmanwillow21/">oldmanwillow21</a> 15 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/ezy3an1/">9 days ago</a> 
   · edited 9 days ago</p>
   <blockquote>

      <p>Jumbled mess of thoughts surely to follow.</p>

      <p>When I discuss projects with peers and mention that I chose to develop in Perl, the responses range from passive bemusement, 
      to scorn, to ridicule. The assumption is usually that I'm using a dead language that's crippled in functionality and uses syntax 
      that will surely make everyone's eyes bleed to read. This is the culture everywhere from the casual hackers to the C-suite.</p>

      <p>I've proven at work that I can write nontrivial software using Perl. I'm still asked to use Python or Go (edit: or node, ugh) 
      for any project that'll have contributors from other teams, or to containerize apps using Docker to remove the need for Perl knowledge 
      for end-users (no CPAN, carton, etc.). But I'll take what I can get, and now the attitude has gone from "get with the times" or 
      "that's cute", to "ok but I don't expect everyone else to know it".</p>

      <p>Perl has got a lot to offer, and I vastly enjoy using it over other languages I work with. I know that all the impassioned 
      figures in the Perl community love it just the same, but the community's got some major fragmentation going on. I understand that 
      everyone's got ideas about the future of the language, but is this really the best time to pull the community apart? I feel like 
      if everyone was able to let go of their ego and put their heads together to bring us to a point of stability, even a place where 
      we're not laughed at for professing our support for the language, it would be a major step in the right direction. I think we're 
      heading to the bottom fast, otherwise.</p>

      <p>In that spirit of togetherness, I think the language, particularly the community, needs to be made more accessible to newcomers. 
      Not accessible to one Perl offshoot, but accessible to Perl. It needs to be decided what Perl means in today's day and age. What 
      can it do? Why would I want to use it over another shiny language? What are the definitive places I can go to learn more? Who 
      else will be there? How do I contribute and grow as a Perl developer? There need to be people talking about Perl in places that 
      aren't necessarily hubs for other Perl enthusiasts. It needs to be something business decision-makers can look at and feel confident 
      in using.</p>

      <p>I really hope <em>something</em> changes. I'd be pretty sad if I had to spend the rest of my career writing whatever the trendy 
      language of the day is. These are just observations from someone that likes writing Perl and has been watching from the sidelines.
      </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/PhloxPaniculata/">PhloxPaniculata</a> 2 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/f05yrug/">7 days ago</a></p>
   <blockquote>

      <p><em>Maybe it's not reassuring to hear that, but I took an interest in Perl precisely because it's seen as an underdog and "dead" 
      despite having experienced users and a lot of code, kind of like TCL, Prolog, or Ada.</em> </p>

      <p>Being able to read <a target="_blank" href="http://modernperlbooks.com/books/modern_perl_2016/index.html">Modern Perl</a> for 
      free also helped a lot. I'm still lacking experience in Perl and I've yet to write anything of importance in it because I don't 
      see an area in which it's clearly better than anything else, either because of the language, a package, or a framework, and I 
      don't do a lot of text-munging anymore (I'm also a fan of awk so for small tasks it has the priority). </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/codon011/">codon011</a> 1 point ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/ezy14gs/">9 days ago</a></p>
   <blockquote>

      <p>Don't call it Perl. Unfortunately. Also IME multitasking in Perl5 (or the lack thereof and/or severe issues with) has been 
      a detriment to it's standing in a "multithread all the things" world. </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/crashorbit/">crashorbit</a> 4 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/f00r0e1/">8 days ago</a></p>
   <blockquote>

      <p>So often I see people drag themselves down that "thread my app" path. Eventually realize that they are implementing a whole 
      multi-processing operating system inside their app rather than taking advantage of the perfectly good one they are running on.</p>

      <p>There are several perfectly good ways to do concurrency, multitasking, async IO and so on in perl. Many work well in the single 
      node case and in the multi-node case. Anyone who tells you that multitasking systems are easy because of some implementation language 
      choice has not made it through the whole Dunning Kruger cycle yet. </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/codon011/">codon011</a> 2 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/f0129el/">8 days ago</a></p>
   <blockquote>

      <p>Multithreading is never easy. The processors will always manage to do things in a "wrong" order unless you are very careful 
      with your gatekeeping. However, other languages/frameworks have paradigms that make it seem easier such that those race conditions 
      show up much later in your product lifecycle. </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/codon011/">codon011</a> 3 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/ezy25j4/">9 days ago</a></p>
   <blockquote>

      <p><em>There's a long history of bad code written by mediocre developers who became the only one who could maintain the codebase 
      until they no longer worked for the organization. The next poor sap to go in found a mess of a codebase and did their best to 
      not break it further. After a few iterations, the whole thing is ready for /dev/null and Perl gets the blame.</em></p>

      <p>Bash has limitations, but that (usually) means fewer ways to mess it up. There's less domain knowledge to learn, (afaik) no 
      CPAN equivalent, and fewer issues with things like "I need to upgrade this but I can't because this other thing uses this older 
      version which is incompatible with the newer version so now we have to maintain two versions of the library and/or interpreter."</p>

      <p><em>All in all, Perl is still my first go-to language, but there are definitely some things I wish it did better. </em></p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/crb3/">crb3</a> 3 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/ezy2sz5/">9 days ago</a> 
   · edited 9 days ago</p>
   <ul>

      <li>

      <p>Perl has a largish executable memory-footprint*. If that gets in your way (which can happen in tight spaces such as semi/embedded), 
      you've got two choices: if it's shellable code, go to bash; otherwise, port to C. Or at least, that's my decision tree, and Perl5 
      is my go-to language. I use bash only when I must, and I hit the books every time.</p>
      </li>

      <li>

      <p><em>The Perl leadership Osborned itself with Perl6. 20/20 hindsight says the new project should have been given a different 
      name at conception, that way all the "watch this space -- under construction" signage wouldn't have steered people away from perfectly 
      usable Perl5. Again, IMO.</em></p>
      </li>
   </ul>
   <blockquote>

      <p>*[e:] Consider, not just core here, but CPAN pull-in as well. I had one project clobbered on a smaller-memory machine when 
      I tried to set up a pure-Perl scp transfer -- there wasn't room enough for the full file to transfer if it was larger than about 
      50k, what with all the CPAN. Shelling to commandline scp worked just fine. </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/beermad/">beermad</a> 2 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/ezz1o8e/">8 days ago</a></p>
   <blockquote>

      <p>To be fair, wrapping a Perl script around something that's (if I read your comment right) just running SCP is adding a pointless 
      extra layer of complexity anyway.</p>

      <p>It's a matter of using the best tool for each particular job, not just sticking with one. My own ~/bin directory has a big 
      mix of Perl and pure shell, depending on the complexity of the job to be done. </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/crb3/">crb3</a> 2 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/ezz7mjs/">8 days ago</a> 
   · edited 7 days ago</p>
   <blockquote>

      <p>Agreed; I brought that example up to illustrate the bulk issue. In it, I was feeling my way, not sure how much finagling I 
      might have to do for the task (backdoor-passing legitimate sparse but possibly quite bulky email from one server to another), 
      which is why I initially went for the pure-Perl approach, so I'd have the mechanics exposed for any needed hackery. The experience 
      taught me to get by more on shelling to precompiled tooling where appropriate... and a healthy respect for CPAN pull-in, [e:] 
      the way that this module depends on that module so <em>it</em> gets pulled in along with its dependencies in turn, and the pileup 
      grows in memory. There was a time or two here and there where I only needed a teeny bit of what a module does, so I went in and 
      studied the code, then implemented it internally as a function without the object's generalities and bulk. The caution learned 
      on ancient x86 boxes now seems appropriate on ARM boards like rPi; what goes around comes around. </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/minimim/">minimim</a> 1 point ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/f0j5lrs/">4 days ago</a></p>
   <blockquote>
      <blockquote>

         <p>wouldn't have steered people away from perfectly usable Perl5</p>
      </blockquote>

      <p>Perl5 development was completely stalled at the time. Perl6 brought not only new blood into it's own effort, it reinvigorated 
      Perl5 in the process.</p>

      <p>It's completely backwards to suggest Perl 5 was fine until perl6 came along. It was almost dormant and became a lively language 
      after Perl 6 was announced. </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/perlancar/">perlancar</a> 2 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/ezzffwx/">8 days ago</a></p>
   <blockquote>

      <p><em>I don't observe the premise at all though. Is bash really gaining ground over anything recently?</em> l</p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/linearblade/">linearblade</a> 3 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/f00ma0f/">8 days ago</a></p>
   <blockquote>

      <p>Perl is better than pretty much everything g out there at what it does.</p>

      <p>But keep in mind,</p>

      <p>They say C sharp is loved by everyone, when in reality it's Microsoft pushing their narrative and the army of "learn by rote" 
      engineers In developing countries</p>

      <p><em>Python again is loved, because "taught by rote" idiots. Now you can give them pretty little packages. And it's no wonder 
      they can do little better than be glorified system admins (which id rather have a real sys admin, since he's likely to understand 
      Perl)</em></p>

      <p><em>Making a new language means lots of new training. Lots of profit in this. Nobody profits from writing new books on old 
      languages. Lots of profit in general from supporting a new language. In the end, owning the language gets you profits.</em></p>

      <p><em>And I still don't get why tab for blocks python is even remotely more readable than Perl.</em></p>

      <p><em>If anything, JavaScript is pretty dang godly at what it does, I understand why that's popular. But I don't get python one 
      bit, except to employ millions of entry level minions who can't think on their own.</em> </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/duo-rotae/">duo-rotae</a> 6 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/f01ftjb/">8 days ago</a></p>
   <blockquote>

      <p>I know a comp sci professor. I asked why he thought Python was so popular.</p>

      <p><em>"Every teacher I know has students using it. We do it because it's an easy language, there's only one way to do it, and 
      with whitespace as syntax it's easy to grade. We don't teach it because it is some powerful or exceptional language. "</em></p>

      <p>Then he said if he really needs to get something done, it's Perl or C. </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/linearblade/">linearblade</a> 2 points ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/f01hbqm/">8 days ago</a></p>
   <blockquote>

      <p>Yep that's pretty much my opinion from using it. </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/techsnapp/">techsnapp</a> 1 point ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/f0o0758/">2 days ago</a></p>
   <blockquote>

      <p>So is per harder than python because the lack of everyone else using it? </p>
   </blockquote>

   <p><a target="_blank" href="https://www.reddit.com/user/duo-rotae/">duo-rotae</a> 1 point ·
   <a target="_blank" href="https://www.reddit.com/r/perl/comments/d2yix0/how_did_perl_lose_ground_to_bash/f0p2cv9/">2 days ago</a></p>
   <blockquote>

      <p>Perl has a steeper and longer learning with it. curve than Python, and there is more than one way to do anything. And there 
      quite a few that continue coding</p>
   </blockquote>
   <!--TAGS: . ~/Language_wars2-->

<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>


</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190921X_how_did_perl_lose_ground_to_bash"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190919X_min_and_max_functions_in_perl" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190919X_luke_s_thought_dump_cute_perl_gem_to_get_the_minimum_maximum_value"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 19, 2019] <a target="_blank" href="http://timmurphy.org/2012/02/01/min-and-max-functions-in-perl/">Min and max functions in   Perl</a> by Tim</h4>

<blockquote>
<h6>Feb 01, 2012 |  <a target="_blank" href= "http://timmurphy.org/2012/02/01/min-and-max-functions-in-perl/">timmurphy.org</a></h6>
 
 

    <p>Posted: 1st February 2012 by Tim in <a target="_blank" href=
    "http://timmurphy.org/category/software/perl/">Perl</a></p>

    <p>Tags: <a target="_blank" href="http://timmurphy.org/tag/list/">list</a> , <a target="_blank" href="http://timmurphy.org/tag/math/">math</a> , <a target="_blank" href=
    "http://timmurphy.org/tag/max/">max</a> , <a target="_blank" href=
    "http://timmurphy.org/tag/min/">min</a> , <a target="_blank" href=
    "http://timmurphy.org/tag/perl/">Perl</a> , <a target="_blank" href=
    "http://timmurphy.org/tag/script/">script</a> <a target="_blank" href=
    "http://timmurphy.org/2012/02/01/min-and-max-functions-in-perl/#comments">3</a></p>

    <p>Min and max
    functions are available in perl, but you need to load them first. To do this, add</p>

    <p><code>use List::Util qw[min max];</code></p>

    <p>to the top of the script. These functions take a list of numbers and return the min/max of
    that list. The list can have 2 numbers or 100 – it doesn't matter:</p>

    <p><code>use List::Util qw[min max];</code></p>

    <p><code>print min(1,3) . "\n";<br>
    print max(1,2,3,4,5) . "\n";<br>
    print min(1) . "\n";</code></p>
 
<!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_subroutnes_and_functions.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190919X_min_and_max_functions_in_perl"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190919X_luke_s_thought_dump_cute_perl_gem_to_get_the_minimum_maximum_value" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190919X_list_moreutils_s_minmax_is_more_efficient_when_you_need_both_the_min_and_the_max_because"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 19, 2019] <a target="_blank" href="https://lukesthoughtdump.blogspot.com/2009/08/cute-perl-gem-to-get-minimummaximum.html">Luke's   Thought Dump Cute Perl Gem to Get the Minimum-Maximum Value</a></h4>

<h5>Notable quotes:</h5>
<h5>"...  the comparison operators return 1 or 0 for true and false, respectively, which are then used     by this code to index the array ref.  ..."</h5>
<blockquote>
<h6>Sep 19, 2019 |  <a target="_blank" href= "https://lukesthoughtdump.blogspot.com/2009/08/cute-perl-gem-to-get-minimummaximum.html">lukesthoughtdump.blogspot.com</a></h6>
 
 

    <p><b>Sunday, August 2, 2009</b> <b>Cute Perl Gem to Get the Minimum/Maximum Value</b> Saw this
    little nugget on #perl@irc.perl.org the other night. It determines the minimum of two
    values:</p>
    <pre>
[$b, $a]->[$a <= $b]</pre>It takes advantage of the fact that Perl doesn't have a Boolean return type for true or false,
    so <em>the comparison operators return 1 or 0 for true and false, respectively, which are then used
    by this code to index the array ref. </em>

    <p>To get the maximum of the two values, just flip the operator to >= Posted by Luke at
    <a target="_blank" href=
    "https://lukesthoughtdump.blogspot.com/2009/08/cute-perl-gem-to-get-minimummaximum.html"><abbr title="2009-08-02T21:41:00+10:00"
    itemprop="datePublished">9:41 PM</abbr></a></p>

    <p>Labels: <a target="_blank" href=
    "https://lukesthoughtdump.blogspot.com/search/label/hacks">hacks</a> , <a target="_blank" href=
    "https://lukesthoughtdump.blogspot.com/search/label/perl">perl</a></p>
    
 
<!--TAGS: . ~/Financial_skeptic -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_subroutnes_and_functions.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Skeptics/Financial_skeptic/index.shtml-->
<!--file:///f:/Public_html/Skeptics/Financial_skeptic/Casino_capitalism/index.shtml-->
<!--file:///f:/Public_html/Skeptics/Financial_skeptic/Casino_capitalism/Bulletin/casino_capitalism2019.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190919X_luke_s_thought_dump_cute_perl_gem_to_get_the_minimum_maximum_value"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190919X_list_moreutils_s_minmax_is_more_efficient_when_you_need_both_the_min_and_the_max_because" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190916X_perl_for_dummies_cheat_sheet"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 19, 2019] <a target="_blank" href="https://stackoverflow.com/questions/10701210/how-to-find-maximum-and-minimum-value-in-an-array-of-integers-in-perl">   List::MoreUtils's minmax is more efficient when you need both the min and the max (because it does fewer comparisons).</a></h4>

<h5>Notable quotes:</h5>
<h5>"...  List::MoreUtils's  minmax  is more efficient when you need both the min and     the max (because it does fewer comparisons). ..."</h5>
<blockquote>
<h6>Sep 19, 2019 |  <a target="_blank" href= "https://stackoverflow.com/questions/10701210/how-to-find-maximum-and-minimum-value-in-an-array-of-integers-in-perl"> stackoverflow.com</a></h6>
 
 

    <p><b>List::Util's</b> <code>min</code> and <code>max</code> are fine,</p>
    <pre>
use List::Util qw( min max );
my $min = min @numbers;
my $max = max @numbers;
</pre>

    <p>But <em>List::MoreUtils's <code>minmax</code> is more efficient when you need both the min and
    the max (because it does fewer comparisons).</em></p>
    <pre>
use List::MoreUtils qw( minmax );
my ($min, $max) = minmax @numbers;
</pre>

    <p>List::Util is part of core, but List::MoreUtils isn't.</p>

    <p>--ikegami</p>
 
<!--TAGS: . ~/Scripting -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_subroutnes_and_functions.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190919X_list_moreutils_s_minmax_is_more_efficient_when_you_need_both_the_min_and_the_max_because"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190916X_perl_for_dummies_cheat_sheet" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190916X_how_can_i_capture_multiple_matches_from_the_same_perl_regex_stack_overflow"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 16, 2019] <a target="_blank" href="http://www.dummies.com/store/product/Perl-For-Dummies-4th-Edition.productCd-0764537504.html">Perl   For Dummies Cheat Sheet</a></h4>

<blockquote>
<h6>Sep 16, 2019 |  <a target="_blank" href= "http://www.dummies.com/store/product/Perl-For-Dummies-4th-Edition.productCd-0764537504.html">www.dummies.com</a></h6>
 

    <p>From <a target="_blank" href=
    "http://www.dummies.com/store/product/Perl-For-Dummies-4th-Edition.productCd-0764537504.html">Perl
    For Dummies, 4th Edition</a></p>

    <p>By <a target="_blank" href="https://www.dummies.com/?s=&a=paul-hoffman">Paul
    Hoffman</a></p>

    <p>Perl enables you to write powerful programs right from the start, whether you're a
    programming novice or expert. Perl offers the standard programming tools -- comparison
    operators, pattern-matching quantifiers, list functions -- and has shortcuts for inputting
    character ranges. Perl also offers file tests so you can find what you want fast.</p><b>The
    Most Useful File Tests in Perl</b>

    <p>Programming with Perl is fairly straightforward, which runs to the letters you use for file
    tests. For example, <i>r</i> tests whether a file can be <i>r</i> ead, and <i>T</i> looks for a
    <i>t</i> ext file. Here are most useful file tests in Perl:</p>

    <table>
      <tr>
        <th>Test</th>

        <th>Description</th>
      </tr>

      <tr>
        <td>-e</td>

        <td>File exists.</td>
      </tr>

      <tr>
        <td>-r</td>

        <td>File can be read.</td>
      </tr>

      <tr>
        <td>-w</td>

        <td>File can be written to.</td>
      </tr>

      <tr>
        <td>-z</td>

        <td>File is exactly zero bytes long.</td>
      </tr>

      <tr>
        <td>-d</td>

        <td>Named item is a directory, not a file.</td>
      </tr>

      <tr>
        <td>-T</td>

        <td>File is a text file. (The first chunk of a file is examined,<br>
        and it's a text file if fewer than 30 percent or so of the<br>
        characters are nonprintable.)</td>
      </tr>

      <tr>
        <td>-B</td>

        <td>File is a binary file. (This is the exact opposite of the -T<br>
        test -- it's a binary file if more than 30 percent or so<br>
        of the characters are nonprintable.)</td>
      </tr>

      <tr>
        <td>-s</td>

        <td>Size of the file in bytes.</td>
      </tr>

      <tr>
        <td>-C</td>

        <td>Creation age of file.</td>
      </tr>

      <tr>
        <td>-A</td>

        <td>Access age of file.</td>
      </tr>

      <tr>
        <td>-M</td>

        <td>Modification age of file.</td>
      </tr>
    </table><b>Special Characters in Perl</b>

    <p>Like any programming language, Perl uses special commands for special characters, such as
    backspaces or vertical tabs. So, if you need to program in a bell or a beep or just a carriage
    return, check the following table for the character that will produce it:</p>

    <table>
      <tr>
        <th>Character</th>

        <th>Meaning</th>
      </tr>

      <tr>
        <td>n</td>

        <td>Newline</td>
      </tr>

      <tr>
        <td>r</td>

        <td>Carriage return</td>
      </tr>

      <tr>
        <td>t</td>

        <td>Tab character</td>
      </tr>

      <tr>
        <td>f</td>

        <td>Formfeed character</td>
      </tr>

      <tr>
        <td>b</td>

        <td>Backspace character</td>
      </tr>

      <tr>
        <td>v</td>

        <td>Vertical tab</td>
      </tr>

      <tr>
        <td>a</td>

        <td>Bell or beep</td>
      </tr>

      <tr>
        <td>e</td>

        <td>Escape character</td>
      </tr>
    </table><b>Perl True-False Comparison Operators</b>

    <p>When you're programming with Perl -- or any other language -- you use comparison operators
    all the time. The following table shows the common comparisons for Perl in both math and string
    form:</p>

    <table>
      <tr>
        <th>Comparison</th>

        <th>Math</th>

        <th>String</th>
      </tr>

      <tr>
        <td>Equal to</td>

        <td>==</td>

        <td>eq</td>
      </tr>

      <tr>
        <td>Not equal to</td>

        <td>!=</td>

        <td>ne</td>
      </tr>

      <tr>
        <td>Less than</td>

        <td><</td>

        <td>lt</td>
      </tr>

      <tr>
        <td>Greater than</td>

        <td>></td>

        <td>gt</td>
      </tr>

      <tr>
        <td>Less than or equal to</td>

        <td><=</td>

        <td>le</td>
      </tr>

      <tr>
        <td>Greater than or equal to</td>

        <td>>=</td>

        <td>ge</td>
      </tr>
    </table><b>Common List Functions in Perl</b>

    <p>Perl was originally designed to help process reports more easily. Reports often contain
    lists, and you may want to use Perl to perform certain functions within a list. The following
    table shows you common list functions, their splice equivalents, and explains what the function
    does:</p>

    <table>
      <tr>
        <th>Function</th>

        <th>splice Equivalent</th>

        <th>What It Does</th>
      </tr>

      <tr>
        <td>push (@r, @s)</td>

        <td>splice(@r, $#r+1,0, @s)</td>

        <td>Adds to the right of the list</td>
      </tr>

      <tr>
        <td>pop (@r)</td>

        <td>splice(@r, $#r, 1)</td>

        <td>Removes from the right of the list</td>
      </tr>

      <tr>
        <td>shift (@r)</td>

        <td>splice(@r, 0, 1)</td>

        <td>Removes from the left of the list</td>
      </tr>

      <tr>
        <td>unshift (@r, @s)</td>

        <td>splice(@r, 0, 0,@s)</td>

        <td>Adds to the left of the list</td>
      </tr>
    </table><b>Shortcuts for Character Ranges in Perl</b>

    <p>You're programming along in Perl and want to use a code shortcut to represent anything from
    a number to a non-number to any letter or number. You're in luck, because the following table
    gives you the code, shows you what it's a shortcut for, and describes it.</p>

    <table>
      <tr>
        <th>Code</th>

        <th>Replaces</th>

        <th>Description</th>
      </tr>

      <tr>
        <td>d</td>

        <td>[0..9]</td>

        <td>Any digit</td>
      </tr>

      <tr>
        <td>w</td>

        <td>[a-zA-Z_0-9]</td>

        <td>Any alphanumeric character</td>
      </tr>

      <tr>
        <td>s</td>

        <td>[ tnrf]</td>

        <td>A whitespace character</td>
      </tr>

      <tr>
        <td>D</td>

        <td>^[0..9]</td>

        <td>Any non-digit</td>
      </tr>

      <tr>
        <td>W</td>

        <td>^[a-zA-Z_0-9]</td>

        <td>Any non-alphanumeric character</td>
      </tr>

      <tr>
        <td>S</td>

        <td>^[ tnrf]</td>

        <td>A non-whitespace character</td>
      </tr>
    </table><b>Perl Pattern-Matching Quantifiers</b>

    <p>Perl enables you to use common symbols to instruct the program you're writing to match data
    once, never, or up to a certain number of times. The following table shows you which symbol to
    use to get the match you want:</p>

    <table>
      <tr>
        <th>Symbol</th>

        <th>Meaning</th>
      </tr>

      <tr>
        <td>+</td>

        <td>Match 1 or more times</td>
      </tr>

      <tr>
        <td>*</td>

        <td>Match 0 or more times</td>
      </tr>

      <tr>
        <td>?</td>

        <td>Match 0 or 1 time</td>
      </tr>

      <tr>
        <td>{n}</td>

        <td>Match exactly n times</td>
      </tr>

      <tr>
        <td>{n,}</td>

        <td>Match at least n times</td>
      </tr>

      <tr>
        <td>{n,m}</td>

        <td>Match at least n, but not more than m, times (these values must<br>
        be less than 65,536)</td>
      </tr>
    </table>
 <!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_references.shtml-->
<!--file:///f:/Public_html/Scripting/Perlbook/Ch07/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190916X_perl_for_dummies_cheat_sheet"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190916X_how_can_i_capture_multiple_matches_from_the_same_perl_regex_stack_overflow" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190916X_https_www_dummies_com_programming_perl_avoiding_common_oversights_in_perl"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 16, 2019] <a target="_blank" href="https://stackoverflow.com/questions/2884549/how-can-i-capture-multiple-matches-from-the-same-perl-regex">   How can I capture multiple matches from the same Perl regex - Stack Overflow</a></h4>

<blockquote>
<h6>Sep 16, 2019 |  <a target="_blank" href= "https://stackoverflow.com/questions/2884549/how-can-i-capture-multiple-matches-from-the-same-perl-regex"> stackoverflow.com</a></h6>
 

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/questions/2884549/how-can-i-capture-multiple-matches-from-the-same-perl-regex">
    How can I capture multiple matches from the same Perl regex?</a></b> <a target="_blank" href=
    "https://stackoverflow.com/questions/ask">Ask Question</a> Asked 9 years, 4 months ago Active
    <a target="_blank" href=
    "https://stackoverflow.com/questions/2884549/how-can-i-capture-multiple-matches-from-the-same-perl-regex?lastactivity">
    7 years, 4 months ago</a> Viewed 35k times 24 1</p>
    <hr noshade align="left" width="10" size="10">

    <p><b><a target="_blank" href="https://stackoverflow.com/users/2766176/brian-d-foy">brian d
    foy</a></b> ,May 22, 2010 at 15:42</p>

    <blockquote>
      I'm trying to parse a single string and get multiple chunks of data out from the same string
      with the same regex conditions. I'm parsing a single HTML doc that is static (For an
      undisclosed reason, I can't use an HTML parser to do the job.) I have an expression that
      looks like:
      <pre>
$string =~ /\<img\ssrc\="(.*)"/;
</pre>

      <p>and I want to get the value of $1. However, in the one string, there are many img tags
      like this, so I need something like an array returned (@1?) is this possible?</p>
    </blockquote>

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/users/262363/volatilerig">VolatileRig</a></b> ,Jan 14, 2014 at
    19:41</p>

    <blockquote>
      As Jim's answer, use the /g modifier (in list context or in a loop).

      <p>But beware of greediness, you dont want the <code>.*</code> to match more than necessary
      (and dont escape < = , they are not special).</p>
      <pre>
while($string =~ /<img\s+src="(.*?)"/g ) {
  ...
}
</pre>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/205100/robert-wohlfarth">Robert
    Wohlfarth</a></b> ,May 21, 2010 at 18:44</p>

    <blockquote>
      <pre>
@list = ($string =~ m/\<img\ssrc\="(.*)"/g);
</pre>

      <p>The g modifier matches all occurences in the string. List context returns all of the
      matches. See the m// operator in <a target="_blank" href=
      "http://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators">perlop</a> .</p>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/347252/dalton">dalton</a></b>
    ,May 21, 2010 at 18:42</p>

    <blockquote>
      You just need the global modifier /g at the end of the match. Then loop through until there
      are no matches remaining
      <pre>
my @matches;
while ($string =~ /\<img\ssrc\="(.*)"/g) {
        push(@matches, $1);
}
</pre>
    </blockquote>

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/users/262363/volatilerig">VolatileRig</a></b> ,May 24, 2010 at
    16:37</p>

    <blockquote>
      Use the /g modifier and list context on the left, as in
      <pre>
@result = $string =~ /\<img\ssrc\="(.*)"/g;
</pre>
    </blockquote>
 <!--TAGS: . ~/Scripting -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190916X_how_can_i_capture_multiple_matches_from_the_same_perl_regex_stack_overflow"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190916X_https_www_dummies_com_programming_perl_avoiding_common_oversights_in_perl" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190916X_switch_statements"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 16, 2019] <a target="_blank" href="https://www.dummies.com/programming/perl/avoiding-common-oversights-in-perl/">https://www.dummies.com/programming/perl/avoiding-common-oversights-in-perl/</a></h4>

<blockquote>
<h6>Sep 16, 2019 |  <a target="_blank" href= "https://www.dummies.com/programming/perl/avoiding-common-oversights-in-perl/">www.dummies.com</a></h6>
 

    <p><b>Avoiding Common Oversights in Perl</b> <a target="_blank" href=
    "http://www.dummies.com/store/product/Perl-For-Dummies-4th-Edition.productCd-0764537504.html"><img src="https://www.dummies.com/wp-content/uploads/0764537504.jpg"
    alt="" width="84" height="105"></a></p>

    <p>Related Book</p><b>Perl For Dummies, 4th Edition</b>

    <p>By <a target="_blank" href="https://www.dummies.com/?s=&a=paul-hoffman">Paul
    Hoffman</a></p>

    <p>Entering a typo or two during the course of writing a Perl program is not uncommon. But when
    you attempt to run a program containing a text-entry slip-up, Perl usually becomes confused and
    tells you so by reporting an error. The natural reaction for most people, even those with years
    of programming experience, is to get worried or angry or both when an error message pops
    up.</p>

    <p>Don't panic. Take a deep breath. Take another slow, deep breath. Seriously, you can't get to
    the root of the problem if you're all tense and bothered. No matter how many years you program,
    you always end up finding some errors in the code you're written.</p>

    <p>So, now that you are (hopefully!) a bit calmer, you can start to appreciate the fact that
    Perl has more helpful error messages than almost any other programming language. The messages
    aren't always right on the money, but they can get you pretty close to the spot where the
    problem lies with minimal searching on your part.</p>

    <p>Perl has myriad error messages, but a few definitely crop up more than others owing to some
    common typos that everyone seems to make. The following errors result from minor text-entry
    goofs that you can easily avoid.</p><b>Forgetting a semicolon</b>

    <p>Probably the most common error message you see when programming in Perl looks something like
    this:</p>

    <p># syntax error, near "open"<br>
    File 'counter1.pl'; Line 10<br>
    # Execution aborted due to compilation errors.</p>

    <p>You can look and look at Line 10, the one with the open statement, and you won't see
    anything wrong with it. The trick here is to examine the statement that comes <i>before</i> the
    open statement and see whether it ends with a semicolon. (Perl knows that a statement ends only
    when it encounters a semicolon.) In this case, the error is caused by a missing semicolon at
    the end of Line 7 of the program:</p>

    <p>$TheFile = "sample.txt"</p><b>Forgetting a quotation mark</b>

    <p>The following sort of error message can be extremely frustrating if you don't know of a
    quick fix:</p>

    <p># Bare word found where operator expected, near<br>
    # "open(INFILE, $TheFile) or die "The"<br>
    # (Might be a runaway multi-line " string starting on<br>
    # line 7)<br>
    File 'counter1.pl'; Line 10</p>

    <p>This error is similar to forgetting a semicolon; instead, it's a quotation mark that's
    accidentally omitted:</p>

    <p>$TheFile = "sample.txt;</p>

    <p>In this case, Perl did a good job of guessing what is wrong, suggesting that a runaway
    multi-line " string on Line 7 is the problem, which is precisely right.</p><b>Entering one
    parenthesis too many or too few</b>

    <p>When you have loads of opening and closing parentheses in a program, it's easy to slip an
    extra one in by accident. If that's the case, you may see a message from Perl that reads
    something like this:</p>

    <p># syntax error, near ") eq"<br>
    File 'counter1.pl'; Line 38<br>
    # syntax error, near "}"<br>
    File 'counter1.pl'; Line 42</p>

    <p>Here, Perl can't determine where the error is exactly, but it actually got it right on the
    first guess: Line 38 contains an extra right parenthesis:</p>

    <p>if(substr($TheLine, $CharPos, 1)) eq " ")</p>

    <p>Having one parenthesis too few in a Perl program can cause harder-to-find problems:</p>

    <p># Can't use constant item as left arg of implicit -- >,<br>
    # near "1 }"<br>
    File 'counter1.pl'; Line 39<br>
    # Scalar found where operator expected, near "$CharPos"<br>
    File 'counter1.pl'; Line 40<br>
    # (Missing semicolon on previous line?)<br>
    # syntax error, near "$CharPos "<br>
    File 'counter1.pl'; Line 40</p>

    <p>Yarp! All this was produced because the last parenthesis on Line 38 is missing:</p>

    <p>if(substr($TheLine, $CharPos, 1) eq " "</p>

    <p>Here is another good lesson in hunting down typing errors: Start where Perl says it found an
    error. If you don't find the error there, go up a line or two and see if the problem started
    earlier.</p>

    <p>A final word of advice: Trust Perl to find the simple typos for you (where it can), and
    remember that it's giving you all the help it can, which is more than you can say for many
    programming languages.</p>
 <!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_debugging.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190916X_https_www_dummies_com_programming_perl_avoiding_common_oversights_in_perl"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190916X_switch_statements" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190912X_why_is_perl_no_longer_a_popular_programming_language_quora"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 16, 2019] <a target="_blank" href="https://perldoc.perl.org/perlsyn.html#Switch-Statements">Switch Statements</a></h4>

<blockquote>
<h6>Sep 16, 2019 |  <a target="_blank" href= "https://perldoc.perl.org/perlsyn.html#Switch-Statements">perldoc.perl.org</a></h6>
 

    <p>Starting from Perl 5.10.1 (well, 5.10.0, but it didn't work right), you can say</p>

    <ol>
      <li><a target="_blank" href="https://perldoc.perl.org/functions/use.html">use</a> feature
      "switch" ;</li>
    </ol>

    <p>to enable an experimental switch feature. This is loosely based on an old version of a Perl
    6 proposal, but it no longer resembles the Perl 6 construct. You also get the switch feature
    whenever you declare that your code prefers to run under a version of Perl that is 5.10 or
    later. For example:</p>

    <ol>
      <li><a target="_blank" href="https://perldoc.perl.org/functions/use.html">use</a> v5.14
      ;</li>
    </ol>

    <p>Under the "switch" feature, Perl gains the experimental keywords <code><a target="_blank" href="https://perldoc.perl.org/functions/given.html">given</a></code> , <code><a target=
    "_blank" href="https://perldoc.perl.org/functions/when.html">when</a></code> , <code><a target=
    "_blank" href="https://perldoc.perl.org/functions/default.html">default</a></code> ,
    <code><a target="_blank" href=
    "https://perldoc.perl.org/functions/continue.html">continue</a></code> , and <code><a target=
    "_blank" href="https://perldoc.perl.org/functions/break.html">break</a></code> . Starting from
    Perl 5.16, one can prefix the switch keywords with <code>CORE::</code> to access the feature
    without a <code><a target="_blank" href="https://perldoc.perl.org/functions/use.html">use</a>
    feature</code> statement. The keywords <code><a target="_blank" href=
    "https://perldoc.perl.org/functions/given.html">given</a></code> and <code><a target="_blank" href="https://perldoc.perl.org/functions/when.html">when</a></code> are analogous to
    <code>switch</code> and <code>case</code> in other languages -- though <code><a target="_blank" href="https://perldoc.perl.org/functions/continue.html">continue</a></code> is not -- so the
    code in the previous section could be rewritten as</p>

    <ol>
      <li><a target="_blank" href="https://perldoc.perl.org/functions/use.html">use</a> v5.10.1
      ;</li>

      <li><a target="_blank" href="https://perldoc.perl.org/functions/for.html">for</a> ( $var )
      {</li>

      <li><a target="_blank" href="https://perldoc.perl.org/functions/when.html">when</a> ( /^abc/
      ) { $abc = 1 }</li>

      <li><a target="_blank" href="https://perldoc.perl.org/functions/when.html">when</a> ( /^def/
      ) { $def = 1 }</li>

      <li><a target="_blank" href="https://perldoc.perl.org/functions/when.html">when</a> ( /^xyz/
      ) { $xyz = 1 }</li>

      <li>default { $nothing = 1 }</li>

      <li>}</li>
    </ol>

    <p>The <code><a target="_blank" href=
    "https://perldoc.perl.org/functions/foreach.html">foreach</a></code> is the non-experimental
    way to set a topicalizer. If you wish to use the highly experimental <code><a target="_blank" href="https://perldoc.perl.org/functions/given.html">given</a></code> , that could be written
    like this:</p>

    <ol>
      <li><a target="_blank" href="https://perldoc.perl.org/functions/use.html">use</a> v5.10.1
      ;</li>

      <li><a target="_blank" href="https://perldoc.perl.org/functions/given.html">given</a> ( $var
      ) {</li>

      <li><a target="_blank" href="https://perldoc.perl.org/functions/when.html">when</a> ( /^abc/
      ) { $abc = 1 }</li>

      <li><a target="_blank" href="https://perldoc.perl.org/functions/when.html">when</a> ( /^def/
      ) { $def = 1 }</li>

      <li><a target="_blank" href="https://perldoc.perl.org/functions/when.html">when</a> ( /^xyz/
      ) { $xyz = 1 }</li>

      <li>default { $nothing = 1 }</li>

      <li>}</li>
    </ol>

    <p>As of 5.14, that can also be written this way:</p>

    <ol>
      <li><a target="_blank" href="https://perldoc.perl.org/functions/use.html">use</a> v5.14
      ;</li>

      <li><a target="_blank" href="https://perldoc.perl.org/functions/for.html">for</a> ( $var )
      {</li>

      <li>$abc = 1 <a target="_blank" href="https://perldoc.perl.org/functions/when.html">when</a>
      /^abc/ ;</li>

      <li>$def = 1 <a target="_blank" href="https://perldoc.perl.org/functions/when.html">when</a>
      /^def/ ;</li>

      <li>$xyz = 1 <a target="_blank" href="https://perldoc.perl.org/functions/when.html">when</a>
      /^xyz/ ;</li>

      <li>default { $nothing = 1 }</li>

      <li>}</li>
    </ol>

    <p>Or if you don't care to play it safe, like this:</p>

    <ol>
      <li><a target="_blank" href="https://perldoc.perl.org/functions/use.html">use</a> v5.14
      ;</li>

      <li><a target="_blank" href="https://perldoc.perl.org/functions/given.html">given</a> ( $var
      ) {</li>

      <li>$abc = 1 <a target="_blank" href="https://perldoc.perl.org/functions/when.html">when</a>
      /^abc/ ;</li>

      <li>$def = 1 <a target="_blank" href="https://perldoc.perl.org/functions/when.html">when</a>
      /^def/ ;</li>

      <li>$xyz = 1 <a target="_blank" href="https://perldoc.perl.org/functions/when.html">when</a>
      /^xyz/ ;</li>

      <li>default { $nothing = 1 }</li>

      <li>}</li>
    </ol>

    <p>The arguments to <code><a target="_blank" href=
    "https://perldoc.perl.org/functions/given.html">given</a></code> and <code><a target="_blank" href="https://perldoc.perl.org/functions/when.html">when</a></code> are in scalar context, and
    <code><a target="_blank" href="https://perldoc.perl.org/functions/given.html">given</a></code>
    assigns the <code>$_</code> variable its topic value.</p>

    <p>Exactly what the <i>EXPR</i> argument to <code><a target="_blank" href=
    "https://perldoc.perl.org/functions/when.html">when</a></code> does is hard to describe
    precisely, but in general, it tries to guess what you want done. Sometimes it is interpreted as
    <code>$_ ~~ <i>EXPR</i></code> , and sometimes it is not. It also behaves differently when
    lexically enclosed by a <code><a target="_blank" href=
    "https://perldoc.perl.org/functions/given.html">given</a></code> block than it does when
    dynamically enclosed by a <code><a target="_blank" href=
    "https://perldoc.perl.org/functions/foreach.html">foreach</a></code> loop. The rules are far
    too difficult to understand to be described here. See <a target="_blank" href=
    "https://perldoc.perl.org/perlsyn.html#Experimental-Details-on-given-and-when">Experimental
    Details on given and when</a> later on.</p>

    <p>Due to an unfortunate bug in how <code><a target="_blank" href=
    "https://perldoc.perl.org/functions/given.html">given</a></code> was implemented between Perl
    5.10 and 5.16, under those implementations the version of <code>$_</code> governed by
    <code><a target="_blank" href="https://perldoc.perl.org/functions/given.html">given</a></code>
    is merely a lexically scoped copy of the original, not a dynamically scoped alias to the
    original, as it would be if it were a <code><a target="_blank" href=
    "https://perldoc.perl.org/functions/foreach.html">foreach</a></code> or under both the original
    and the current Perl 6 language specification. This bug was fixed in Perl 5.18 (and lexicalized
    <code>$_</code> itself was removed in Perl 5.24).</p>

    <p>If your code still needs to run on older versions, stick to <code><a target="_blank" href=
    "https://perldoc.perl.org/functions/foreach.html">foreach</a></code> for your topicalizer and
    you will be less unhappy.</p>
 <!--TAGS: . ~/Switch -->
 <!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190916X_switch_statements"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190912X_why_is_perl_no_longer_a_popular_programming_language_quora" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190912X_cmos_12_randal_schwartz_the_host_of_floss_weekly"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 12, 2019] <a target="_blank" href="https://www.quora.com/Why-is-Perl-no-longer-a-popular-programming-language?redirected_qid=28281947">   Why is Perl no longer a popular programming language - Quora</a></h4>

<blockquote>
<h6>May 19, 2019 |  <a target="_blank" href= "https://www.quora.com/Why-is-Perl-no-longer-a-popular-programming-language?redirected_qid=28281947"> www.quora.com</a></h6>
 

    <ol>
      <li>die " Reports of my death are greatly exaggerated . \n "</li>
    </ol>

    <p>Perl is alive and well, but it has steadily been losing <i>promise</i> over the past 20
    years.</p>

    <p>It's still heavily used for the tasks it was used for when I learnt it, in 1994–1995,
    but at that time, it looked set for an even brighter future: it was developing into one of the
    top-5 languages, a universal scripting language, a language you expect to find wherever
    scripting or dynamically typed languages are appropriate.</p>

    <p>You can still find evidence of that today: some software has an extension API in Perl, some
    web applications are written in Perl, some larger system administration software is written in
    Perl, etcetera. But these systems are typically 20 years old. If you do this today, be prepared
    to justify yourself.</p>

    <p>This is not because Perl has become any less suitable for doing these things. On the
    contrary, it has continued to improve. Yet, people have turned away from Perl, towards newer
    scripting languages such as Python, PHP, Ruby, and Lua, for tasks that in 1995 they would
    probably have used Perl for.</p>

    <p>Why?</p>

    <p>I believe the reason is simple: Perl is very free, syntactically and semantically. This
    makes it very good at what it was designed to do (scripting) but less suited for larger-scale
    programming.</p>

    <p>Perl's syntactic freedom mostly originates from its mimicking idioms from other languages.
    It was designed to be a suitable replacement for other scripting languages, most notably the
    <a target="_blank" href="https://en.wikipedia.org/wiki/Bourne_shell">Bourne shell</a> (
    <code>/bin/ sh</code> ) and <code>awk</code> , so it adopts some of their idioms. This is
    perfect if you like these idioms for their compactness.</p>

    <p>For instance, in the Bourne shell, we can write</p>

    <ol>
      <li>if mkdir $directory</li>

      <li>then</li>

      <li>echo successfully created directory : $directory</li>

      <li>elif test - d $directory</li>

      <li>then</li>

      <li>echo pre - existing directory : $directory</li>

      <li>else</li>

      <li>echo cannot create directory : $directory</li>

      <li>fi</li>
    </ol>

    <p>In the Bourne shell, every statement is a Unix command invocation; in this case,
    <code>test</code> and <code>mkdir</code> . (Some commands, such as <code>test</code> , were
    built into the shell later.) Every command will succeed or fail, so we can use it in the
    condition of an <code>if</code> statement.</p>

    <p>Now what if we only want to print a warning when something went wrong? We can write
    this:</p>

    <ol>
      <li>if mkdir $directory</li>

      <li>then</li>

      <li>: # nothing</li>

      <li>elif test - d $directory</li>

      <li>then</li>

      <li>: # nothing</li>

      <li>else</li>

      <li>echo cannot create directory : $directory</li>

      <li>fi</li>
    </ol>

    <p>or we can combine the two conditions:</p>

    <ol>
      <li>if mkdir $directory || test - d $directory</li>

      <li>then</li>

      <li>: # nothing</li>

      <li>else</li>

      <li>echo cannot create directory : $directory</li>

      <li>fi</li>
    </ol>

    <p>or we can combine them even further:</p>

    <ol>
      <li>mkdir $directory ||</li>

      <li>test - d $directory ||</li>

      <li>echo cannot create directory : $directory</li>
    </ol>

    <p>These all do the same exact thing; clearly, the last version is the most compact. In a shell
    script with a lot of tests like this, writing things this way can save a considerable amount of
    space. Especially in throwaway scripts of a few lines, it's a lot easier to use more compact
    syntax.</p>

    <p>Most programmers are familiar with seeing some special syntax for conditions in
    <code>if</code> statements. For this reason, Unix has the <code>[</code> command, which scans
    its arguments for a matching ], and then invokes <code>test</code> with the arguments up to
    that point. So we can always replace</p>

    <ol>
      <li>test - d $directory</li>
    </ol>

    <p>with</p>

    <ol>
      <li>[ - d $directory ]</li>
    </ol>

    <p>in the pieces of code above. It means the same thing.</p>

    <p>Now, Perl comes onto the scene. It is designed to be easy to replace Bourne shell scripts
    with. This is a very frequent use case for Perl, even today: I regularly find myself rewriting
    my Bourne shell scripts into Perl by going through them line by line.</p>

    <p>So what do the Perl replacements of the above look like?</p>

    <p>Here we go:</p>

    <ol>
      <li>if ( mkdir $directory )</li>

      <li>{</li>

      <li># nothing</li>

      <li>} elsif (- d $directory )</li>

      <li>{</li>

      <li># nothing</li>

      <li>} else {</li>

      <li>say "cannot create directory: $directory"</li>

      <li>}</li>
    </ol>

    <p>or we can combine the two conditions:</p>

    <ol>
      <li>if ( mkdir $directory || - d $directory )</li>

      <li>{</li>

      <li># nothing</li>

      <li>} else {</li>

      <li>say "cannot create directory: $directory"</li>

      <li>}</li>
    </ol>

    <p>or we can combine them even further:</p>

    <ol>
      <li>mkdir $directory or</li>

      <li>- d $directory or</li>

      <li>say "cannot create directory: $directory"</li>
    </ol>

    <p>As you can see, these are literal transliterations of the corresponding Bourne shell
    fragments.</p>

    <p>In a language such as Java, you can use the first two forms, but not the third one. In such
    languages, there is a syntactic separation between <i>expressions</i> , which yield a value,
    and must be used in a context that demands such a value, and <i>statements</i> , which do not
    yield a value, and must be used in contexts that do not demand one. The third form is
    syntactically an expression, used in a context that demands a statement, which is invalid in
    such a language.</p>

    <p>No such distinction is made in Perl, a trait it inherited from the Bourne shell, which in
    turn took it from Algol 68.</p>

    <p>So here we have an example of syntactic freedom in Perl that many other languages lack, and
    in this case, Perl took it from the Bourne shell.</p>

    <p>Allowing more compactness isn't the only reason for this freedom. The direct reason the
    Bourne shell doesn't make the distinction is that it relies on Unix commands, which do not make
    the distinction, either. Every Unix command can return a value (a return code) to indicate
    whether it failed and how. Therefore, it acts both as a statement and as a condition. There is
    a deeper reason behind this: concurrency.</p>

    <p>For instance, when we want to create a directory, we can't separate doing it from testing
    whether it can/could be done. We could try and write something like</p>

    <ol>
      <li>if ( some test to see if we can mkdir $directory )</li>

      <li>then</li>

      <li>mkdir directory</li>

      <li>fi</li>

      <li>if ( some test to see if we managed to mkdir directory )</li>

      <li>then</li>

      <li>[...]</li>

      <li>fi</li>
    </ol>

    <p>but that logic isn't correct. Unix is a multiprogramming environment, so anything could
    happen between our first test and our <i>mkdir</i> command, and before our <i>mkdir</i> command
    and the second test. Someone else might create that directory or remove it, or do something
    else that causes problems. Therefore, the only correct way to write code that tries to create a
    directory and determines whether it succeeds is to actually issue the <i>mkdir</i> command and
    check the value it returned. Which is what the constructs above do.</p>

    <p>A shortcut like</p>

    <ol>
      <li>mkdir $directory or</li>

      <li>- d $directory or</li>

      <li>say "cannot create directory: $directory"</li>
    </ol>

    <p>is just a consequence. Of course, you can still object to using it for stylistic reasons,
    but at least the construct makes sense once you know its origins.</p>

    <p>Programmers who are unfamiliar with the paradigm of mixing statements and expressions, who
    have never seen any but the simplest of Bourne shell scripts, who have only been given
    programming tasks in which their program calls all the shots and nothing else can interfere,
    have never encountered a reason to treat statements and expressions as the same thing. They
    will be taken aback by a construct like this. <i>I can't read this</i> , they will mutter,
    <i>it's incomprehensible gibberish</i> . And if Perl is the first language they've seen that
    allows it, they will blame Perl. Only because they were never subjected to a large amount of
    Bourne shell scripting. Once you can read that, you can read <i>anything</i> ; Perl will look
    pretty tame in comparison.</p>

    <p>Similar reasons can be given for most of the other syntactical freedom in Perl. I must say,
    Perl sometimes seems to make a point of being quirky, and I find some of the resulting oddities
    hard to justify, but they do make sense in context. The overall motivation is compactness. In
    scripting, where you type a lot and throw away a lot, the ability to write compact code is a
    great virtue.</p>

    <p>Due to these syntactic quirks, Perl got a reputation for being a write-only language -
    meaning that when programmer <i>A</i> is faced with programmer <i>B</i> 's code, <i>B</i> may
    have used all kinds of idioms that <i>A</i> is unfamiliar with, causing delays for <i>A</i> .
    There is some truth to this, but the problem is exaggerated: syntax is the first thing you
    notice about a program, which is why it sticks out, but it's pretty superficial: new syntax
    really isn't so hard to learn.</p>

    <p>So I'm not really convinced Perl's syntactic freedom is such a bad thing, except that people
    tend to blow it out of proportion.</p>

    <p>However, Perl is also very free <i>semantically</i> : it is a truly dynamic language,
    allowing programmers to do all kinds of things that stricter languages forbid. For instance, I
    can <a target="_blank" href="https://en.wikipedia.org/wiki/Monkey_patch">monkey-patch</a>
    functions and methods in arbitrary code that I'm using. This can make it very hard for
    programmers to understand how a piece of code is working, or whether it is working as
    intended.</p>

    <p>This becomes more important when a software system grows larger or when others than the
    original author start to rely on it. The code doesn't just need to work, but it must be
    understandable to others. Consequently, in large, stable code bases, compactness and freedom of
    expression are less important than consistency, a smooth learning curve for beginners, and
    protection against routine errors. Therefore, many software development teams prefer languages
    such as Java, with its very limited syntactic freedom and strict compile-time type checking.
    Perl is at the opposite end of the spectrum, with its extreme syntactic and semantic
    freedom.</p>

    <p>This wouldn't be a problem if there were ways to straitjacket Perl if you wanted to; if
    there was a way to say: for this project, be as rigid as Java syntactically or semantically; I
    want as few surprises as possible in code that I didn't write. Sure enough, Perl has support
    for compile-time checking ( <code>use strict</code> ; <code>use warnings</code> , and the
    <code>perlcritic</code> utility) and consistent code formatting (the <code>perltidy</code>
    utility), but they were added as afterthoughts and cannot come anywhere near the level of
    strictness a Java programmer would expect.</p>

    <p>To support that, the language needed to be redesigned from scratch, and the result would be
    incompatible with the original. This effort has been made, producing Perl 6, but in the
    meantime, many other languages sprung up and became popular for the cases Perl programmers
    wanted to use Perl for, and if you're going to switch to an incompatible language anyway, why
    not use one of those instead?</p>
 <!--TAGS: . ~/Perl -->
 <!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190912X_why_is_perl_no_longer_a_popular_programming_language_quora"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190912X_cmos_12_randal_schwartz_the_host_of_floss_weekly" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190912X_prename_rename_files_using_any_perl_expressior_regex_tr_etc"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 12, 2019] <a target="_blank" href="https://code-maven.com/cmos-12-randal-schwartz">CMOS   #12- Randal Schwartz the host of FLOSS Weekly</a></h4>

<h5>The fate of Perl 6 is unclear but Perl 5.10 is here to stay. Some thing were screwed after Perl 5.10, but they might be 
  eventually corrected. OO-enthusiasts did a every bad service to Perl trying to enforce unsuitable for programming, say, utilities 
  paradigm on everybody. That led to huge inefficiencies and bloated difficult to maintain code.  That also somewhat devalued 
  Perl standard library as the conversion to OO spoiled the broth. </h5>
<h5>Notable quotes:</h5>
<h5>"...  I'm keeping up with Perl, but not really, I still see a feature, like in Perl 5.16, and     I go,  Oh, that's in relatively modern Perl, no wonder I don't know about it.  I think of     Perl as whatever was back in 5.10 and 5.12, that's the latest that I was writing my books for,     my trainings for. ..."</h5>
<h5>"...  So the stuff that's coming out in 5.18 and 5.20 and 5.22 now, is sort of beyond me, I     just can't keep up with Perl-delta, and that's a scary thing for the number one prolific author     about Perl, to not be able to keep up with what's happening in the Perl community, this is     clearly an indication that Perl is alive and well, and I've kind of missed the boat,     now. ..."</h5>
<h5>"...  And every time I go to  YAPC  or some other place where they're talking about Perl 6, I get     excited about it, for all of a month, and then I come back and then I go,  How am I going to     use this practically? None of my current clients are demanding that. ..."</h5>
<blockquote>
<h6>Sep 12, 2019 |  <a target="_blank" href= "https://code-maven.com/cmos-12-randal-schwartz">code-maven.com</a></h6>
 

    <p><b>09:24 Randal Schwartz</b></p>
    <blockquote>
       Yeah, I think a few years ago, it was all about cloud stuff. So it
    was all about running your application in cloud. Starting probably a couple years ago, with the
       <a target="_blank" href="https://www.docker.com/">Docker</a> revolution, it's all about
    containers now.

       <p>But we're also seeing a revolution in smart, JavaScript-based ultimately, front-ends, that
    are doing things like <a target="_blank" href=
    "https://en.wikipedia.org/wiki/Single-page_application">single-page applications</a> and stuff,
    and I'm really pretty excited about that. Not that I ever really wanted to spend a lot of time
    playing with JavaScript, but unfortunately I guess that that's a requirement, so I'm continuing
    to hone my JavaScript skills.</p>

       <p>I'm also honing my <a target="_blank" href="https://www.dartlang.org/">Dart</a> skills,
    because that language out of Google, is really gaining some traction, in terms of being able to
    do server-side stuff, essentially replacing <a target="_blank" href=
    "https://nodejs.org/en/">Node.JS</a> with a reasonable language. And also client-side stuff for
    all the modern browsers, and it translating down into JavaScript, so as long as there's a
    reasonable <a target="_blank" href="https://en.wikipedia.org/wiki/ECMAScript">ECMA 5</a> or
    something available in the browser, Dart works really nicely. But Dart looks closer, as a
    language, to something like Java, with optional typing, so if you add types to variables, you
    can actually get hints from your development environment and that's pretty slick. So I'm
    learning Dart in the background, I actually have a couple applications for it already, that as
    I learn more, I'll be able to deploy. I'm also learning things like <a target="_blank" href=
    "https://angularjs.org/">Angular</a> , so I can have reactive front-ends, and again, it's like
    there's not enough hours in the day for me to learn everything I want to learn.</p>

       <p><em>I'm keeping up with Perl, but not really, I still see a feature, like in Perl 5.16, and
    I go, <q>Oh, that's in relatively modern Perl, no wonder I don't know about it.</q> I think of
    Perl as whatever was back in 5.10 and 5.12, that's the latest that I was writing my books for,
    my trainings for.</em></p>

       <p><em>So the stuff that's coming out in 5.18 and 5.20 and 5.22 now, is sort of beyond me, I
    just can't keep up with Perl-delta, and that's a scary thing for the number one prolific author
    about Perl, to not be able to keep up with what's happening in the Perl community, this is
    clearly an indication that Perl is alive and well, and I've kind of missed the boat,
    now.</em></p>
    </blockquote>

    <p><b>17:53 Gabor Szabo Yeah, so as a closing question, I would like to go back a little bit to
    the languages and the things you do with open source, and ask you, where are you heading? Are
    you going to go back to Perl and learn what the new things in Perl are, or are you more
    interested in other languages, and which ones?</b></p>

    <p><b>18:16 Randal Schwartz </b></p>
    <blockquote>

       <p>Well, I download and compile <a target="_blank" href=
    "http://perl6.org/">Perl 6</a> every day. <em>And every time I go to <a target="_blank" href=
    "http://www.yapc.org/">YAPC</a> or some other place where they're talking about Perl 6, I get
    excited about it, for all of a month, and then I come back and then I go, <q>How am I going to
    use this practically? None of my current clients are demanding that.</em></q></p>

       <p>Clearly if I were to write training materials for that, I'd have to present it at least to 200
    people, whether that's 10 classes of 20, or a giant 200 person week-end event, that's sort of
    the minimum for amortizing the inception cost for any class that I've ever written. So I use
    the 200 number as kind of a rule of thumb.</p>

       <p>And I just don't see that happening, I don't see getting enough people together in the right
    places, to be able to do that. So I continue to watch what people are doing with Perl 6, I
    continue compiling it every day, and I'd love for it to become extremely popular so I could go
    back to that, and say I could continue my Perl heritage.</p>

       <p>But, as I mentioned earlier, I think Dart has legs. Given that Google's behind it, given
    that Google and a number of other companies are already deploying public-facing projects in it.
    Given that it does compile down and work in all modern browsers, I easily see the need for like
    <q>rent a hotel room for a weekend</q> and have 20, 50, 100 people show up to learn about it,
    because single-page applications are all the rage right now, and Dart is a really solid
    language for that, and Google is betting on that.</p>

       <p>You may say, <q>Where is Go in that equation?</q> Go is great for server-side stuff, and
    great for the kind of things they're doing on back-ends, and although Dart can also do back-end
    stuff, essentially replacing Node.JS for that sort of thing, and have a single language for
    both back-end and front-end. Dart's real win is in the front-end, being able to be transpiled
    over to JavaScript and being able to scale to hundreds of thousands of lines of code for some
    of their larger applications. I think that's got legs, I'm in on the groundfloor, like I was on
    Perl, I'm already recognized among the Dart people as being someone who can put things
    together. I did a one-hour long intro to Dart talk that was reviewed by some of the key people
    in the Dart community, and they really like what I did with it, so I seem to have, again, that
    knack for finding something complex and finding the simplest ends of it, and I'm already there
    with Dart.</p>

       <p>And also, the whole <a target="_blank" href=
    "https://en.wikipedia.org/wiki/Google_Fuchsia">Fuchsia</a> announcement a few weeks ago, where
    Google's coming out with this language for real-time operating systems, and it has a strong
    Dart component in it. I think that's another thing that says, say if they start putting that in
       <a target="_blank" href="https://en.wikipedia.org/wiki/Google_Glass">Google Glass</a> , or if
    they even put that as a replacement for the Android operating system, or for Google Chrome,
    which some people are suspecting that this is all amalgamation of it.</p>

       <p>Especially when somebody's looking at the source code the other day, and it has a lot of
    files, not only from Android, but also from the old <a target="_blank" href=
    "https://en.wikipedia.org/wiki/BeOS">Be OS</a> , which was sort of the predecessor of what
    eventually became OS X, kind of interesting that that's part of that project as well.</p>

       <p>So with Fuchsia on the horizon, with Dart already being deployed by numbers of people, with
    me having a knack for understanding how Dart actually works, given that it was also built by
    some of the key players in Smalltalk, which I go back 16 years with, I think this is probably
    the right place for me to look at my future.</p>
    </blockquote>

    <p><b>22:02 Gabor Szabo And I guess, FLOSS Weekly?</b></p>

    <p><b>22:05 Randal Schwartz </b></p>
    <blockquote>

       <p>FLOSS Weekly will continue.</p>

       <p>In fact I just had a converstaion recently with Leo, we're one of the smaller shows on the
    network, but he's absolutely committed to this show. He likes what I'm doing with it, he likes
    the directions I'm taking it, he likes the team I've put together, who were able to pick up the
    show, even when I was absent for six weeks, in the hospital recently, without notice
    unfortunately, I guess that's always the way you end up in the hospital.</p>

       <p>So my team picked up, and Aaron Newcomb did a great job of hosting while I was gone, but Leo
    likes the team I've built and Leo likes the kinds of guests I'm getting on, the variety
    especially. I've had a lot of people write in and say, <q>I don't always want or understand the
    thing you're talking about, but I listen to the way you interview them, and I listen to the
    things you're able to pull out, like what's the governance model, how are you making money with
    this, what got you started?</q> These sorts of things are really sort of cross-project. You
    know, you can learn that sort of stuff about anything you want to start, and like I said, I
    learned a lot already by doing this show and so a lot of the audience is picking that up. And
    we have a fun time.</p>

       <p>I tell jokes sometimes and I have a bad way of making really bad puns. And that's kind of
    the way it works but I really enjoy the show, I'm going to keep doing it. And I told Leo I
    would just keep doing this as long as he let's me, and he goes, <q>Well then, that makes two of
    us. So we'll still be doing this in 20 years, if they let us.</q> And I said, <q>That sounds
    like a great promise, Leo, thank you.</q> So yeah, I'll be doing FLOSS Weekly for at least
    awhile longer.</p>
    </blockquote>

    <p><b>23:45 Gabor Szabo I'm happy to hear that and I hope to see a lot more of that. And I hope to
    see you somewhere, I don't know, maybe at a Dart conference?</b></p>

    <p>23:56 Randal Schwartz </p>
    <blockquote>

       <p>Yeah, that'd be awesome!</p>

       <p>And I think you come to <a target="_blank" href=
    "http://conferences.oreilly.com/oscon">OSCon</a> , occasionally, or maybe, well I've got to get
    out to a <a target="_blank" href="http://act.yapc.eu/">YAPC::Europe</a> or a YAPC::Israel or
    something at some point, but just haven't made those yet. I think it's partially because I need
    to figure out what to pitch to the Perl conference.</p>

       <p>Oh wait, I could just be press again! That's the other thing, is that FLOSS Weekly has
    allowed me to apply as press for OSCon for the last few years, even though I don't have an
    actual talk to give. And <a target="_blank" href="https://www.redhat.com/">Red Hat</a> actually
    invited me to their conference, as press. And I thought, <q>Well, that's the first time that's
    happened. That really says I've made it. That really says that FLOSS Weekly is recognized as
    legitimate press.</q> So I'm wearing a whole 'nother hat, so my hat tree of all my hats,
    hanging up in the corner, has gotten a whole 'nother rung.</p>
    </blockquote>
    
 <!--TAGS: . -->
 <!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190912X_cmos_12_randal_schwartz_the_host_of_floss_weekly"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190912X_prename_rename_files_using_any_perl_expressior_regex_tr_etc" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190910X_perl_modules_and_namespaces"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 12, 2019] <a target="_blank" href="https://gist.githubusercontent.com/javiermon/3939556/raw/b9d0634f2c099b825a483d3d75cae1712fb9aa31/prename.pl">   prename -- rename files using any perl expressior (regex, tr, etc)</a></h4>

<blockquote>
<h6>Sep 12, 2019 |  <a target="_blank" href= "https://gist.githubusercontent.com/javiermon/3939556/raw/b9d0634f2c099b825a483d3d75cae1712fb9aa31/prename.pl"> gist.githubusercontent.com</a></h6>
 
    <pre>
#!/usr/bin/perl -w
#
#  This script was developed by Robin Barker (Robin.Barker@npl.co.uk),
#  from Larry Wall's original script eg/rename from the perl source.
#
#  This script is free software; you can redistribute it and/or modify it
#  under the same terms as Perl itself.
#
# Larry(?)'s RCS header:
#  RCSfile: rename,v   Revision: 4.1   Date: 92/08/07 17:20:30 
#
# $RCSfile: rename,v $$Revision: 1.5 $$Date: 1998/12/18 16:16:31 $
#
# $Log: rename,v $
# Revision 1.5  1998/12/18 16:16:31  rmb1
# moved to perl/source
# changed man documentation to POD
#
# Revision 1.4  1997/02/27  17:19:26  rmb1
# corrected usage string
#
# Revision 1.3  1997/02/27  16:39:07  rmb1
# added -v
#
# Revision 1.2  1997/02/27  16:15:40  rmb1
# *** empty log message ***
#
# Revision 1.1  1997/02/27  15:48:51  rmb1
# Initial revision
#

use strict;

use Getopt::Long;
Getopt::Long::Configure('bundling');

my ($verbose, $no_act, $force, $op);

die "Usage: rename [-v] [-n] [-f] perlexpr [filenames]\n"
    unless GetOptions(
        'v|verbose' => \$verbose,
        'n|no-act'  => \$no_act,
        'f|force'   => \$force,
    ) and $op = shift;

$verbose++ if $no_act;

if (!@ARGV) {
    print "reading filenames from STDIN\n" if $verbose;
    @ARGV = ;
    chop(@ARGV);
}

for (@ARGV) {
    my $was = $_;
    eval $op;
    die $@ if $@;
    next if $was eq $_; # ignore quietly
    if (-e $_ and !$force)
    {
        warn  "$was not renamed: $_ already exists\n";
    }
    elsif ($no_act or rename $was, $_)
    {
        print "$was renamed as $_\n" if $verbose;
    }
    else
    {
        warn  "Can't rename $was $_: $!\n";
    }
}

__END__

=head1 NAME

rename - renames multiple files

=head1 SYNOPSIS

B S ]> S ]> S ]> I S ]>

=head1 DESCRIPTION

C
renames the filenames supplied according to the rule specified as the
first argument.
The I 
argument is a Perl expression which is expected to modify the C
string in Perl for at least some of the filenames specified.
If a given filename is not modified by the expression, it will not be
renamed.
If no filenames are given on the command line, filenames will be read
via standard input.

For example, to rename all files matching C to strip the extension,
you might say

        rename 's/\.bak$//' *.bak

To translate uppercase names to lower, you'd use

        rename 'y/A-Z/a-z/' *

=head1 OPTIONS

=over 8

=item B, B

Verbose: print names of files successfully renamed.

=item B, B

No Action: show what files would have been renamed.

=item B, B

Force: overwrite existing files.

=back

=head1 ENVIRONMENT

No environment variables are used.

=head1 AUTHOR

Larry Wall

=head1 SEE ALSO

mv(1), perl(1)

=head1 DIAGNOSTICS

If you give an invalid Perl expression you'll get a syntax error.

=head1 BUGS

The original C did not check for the existence of target filenames,
so had to be used with care.  I hope I've fixed that (Robin Barker).

=cut



</pre>
 <!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190912X_prename_rename_files_using_any_perl_expressior_regex_tr_etc"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190910X_perl_modules_and_namespaces" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190910X_use_of_uninitialized_value"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 10, 2019] <a target="_blank" href="https://www.javatpoint.com/perl-modules-and-namespaces">Perl Modules and namespaces</a></h4>

<blockquote>
<h6><a target="_blank" href="https://www.javatpoint.com/perl-modules-and-namespaces">javatpoint</a></h6>
 

   <p>A module is a container which holds a group of variables and subroutines which can be used in a program. Every module has a public 
   interface, a set of functions and variables.</p>

   <p>To use a module into your program, require or use statement can be used, although their semantics are slightly different.</p>

   <p>The 'require' statement loads module at runtime to avoid redundant loading of module. The 'use' statement is like require with 
   two added properties, compile time loading and automatic importing.</p>

   <p>Namespace is a container of a distinct set of identifiers (variables, functions). A namespace would be like name::variable .</p>

   <p>Every piece of Perl code is in a namespace.</p>

   <p>In the following code,</p>
   <ol>

      <li>use strict;</li>

      <li>use warnings;</li>

      <li>my $x = "Hello" ;</li>

      <li>$main ::x = "Bye" ;</li>

      <li>print "$main::x\n" ; # Bye</li>

      <li>print "$x\n" ; # Hello</li>
   </ol>

   <p>Here are two different variables defined as x . the $main::x is a package variable and $x is a lexical variable. Mostly we use 
   lexical variable declared with my keyword and use namespace to separate functions.</p>

   <p>In the above code, if we won't use use strict , we'll get a warning message as</p>
   <ol>

      <li>Name "main::x" used only once: possible typo at line..</li>
   </ol>

   <p>The main is the namespace of the current script and of current variable. We have not written anything and yet we are already in 
   the 'main' namespace.</p>

   <p>By adding 'use strict', now we got the following error,</p>
   <ol>

      <li>Global symbol "$x" requires explicit package name</li>
   </ol>

   <p>In this error, we got a new word 'package'. It indicates that we forgot to use 'my' keyword before declaring variable but actually 
   it indicates that we should provide name of the package the variable resides in.</p>
   <hr><b>Perl Switching namespace using package keyword</b>

   <p>Look at the following code,</p>
   <ol>

      <li>use strict;</li>

      <li>use warnings;</li>

      <li>use 5.010;</li>

      <li>sub hii {</li>

      <li>return "main" ;</li>

      <li>}</li>

      <li>package two;</li>

      <li>sub hii {</li>

      <li>return "two" ;</li>

      <li>}</li>

      <li>say main::hii(); # main</li>

      <li>say two::hii(); # two</li>

      <li>say hii(); # two</li>

      <li>package main;</li>

      <li>say main::hii(); # main</li>

      <li>say two::hii(); # two</li>

      <li>say hii(); # main</li>
   </ol>

   <p>Here we are using package keyword to switch from 'main' namespace to 'two' namespace.</p>

   <p>Calling hii() with namespaces returns respective namespaces. Like , say main::hii(); returns 'main' and say two::hii(); returns 
   'two'.</p>

   <p>Calling hii() without namespace prefix, returns the function that was local to the current namespace. In first time, we were in 
   'two' namespace. Hence it returned 'two'. In second time, we switched the namespace using package main. Hence it returns 'main'.</p>
   <!--TAGS: .  -->

<!--file:///f:/Public_html/Scripting/Perlorama/perl_namespaces.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190910X_perl_modules_and_namespaces"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190910X_use_of_uninitialized_value" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190910X_how_do_i_avoid_an_uninitialized_value"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 10, 2019] <a target="_blank" href="https://perlmaven.com/search/undef">Use of   uninitialized value</a></h4>

<blockquote>
<h6>Sep 10, 2019 |  <a target="_blank" href= "https://perlmaven.com/search/undef">perlmaven.com</a></h6>
 
 

    <p><ins data-ad-slot="2003827732" data-ad-client="ca-pub-7760157643054954"></ins></p>

    <ul>
      <li><a target="_blank" href="https://perlmaven.com/search/undef">undef</a></li>

      <li><a target="_blank" href=
      "https://perlmaven.com/search/uninitialized%20value">uninitialized value</a></li>

      <li><a target="_blank" href="https://perlmaven.com/search/$%257C">$|</a></li>

      <li><a target="_blank" href="https://perlmaven.com/search/warnings">warnings</a></li>

      <li><a target="_blank" href="https://perlmaven.com/search/buffering">buffering</a></li>
    </ul><b><a target="_blank" href="https://perlmaven.com/variable-declaration-in-perl">Prev</a>
    <a target="_blank" href="https://perlmaven.com/barewords-in-perl">Next</a></b> This is one of
    the most common warning you will encounter while running Perl code.

    <p>It is a warning, it won't stop your script from running and it is only generated if warnings
    were turned on. Which is recommended.</p>

    <p>The most common way to turn on warnings is by including a use warnings; statement at the
    beginning of your script or module.</p>

    <p>Are you serious about Perl? Check out my <a target="_blank" href=
    "https://leanpub.com/perl-maven">Beginner Perl Maven book</a> .<br>
    I have written it for you!</p>

    <p>The older way is adding a -w flag on the sh-bang line. Usually looks like this as the first
    line of your script:</p>

    <p>#!/usr/bin/perl -w</p>

    <p>There are certain differences, but as use warnings is available for 12 years now, there is
    no reason to avoid it. In other words:</p>

    <p>Always use warnings; !</p>

    <p>Let's go back to the actual warning I wanted to explain.</p><b>A quick explanation</b>
    <pre>
Use of uninitialized value $x in say at perl_warning_1.pl line 6.
</pre>

    <p>This means the variable $x has no value (its value is the special value undef ). Either it
    never got a value, or at some point undef was assigned to it.</p>

    <p>You should look for the places where the variable got the last assignment, or you should try
    to understand why that piece of code has never been executed.</p><a target="_blank" href=
    "https://leanpub.com/perl-maven/"><img src=
    "https://perlmaven.com/img/perl-maven-book-cover-306x396.png"></a> <b>A simple example</b>

    <p>The following example will generate such warning.</p>

    <ol>
      <li>use warnings ;</li>

      <li>use strict ;</li>

      <li>use 5.010 ;</li>

      <li>my $x ;</li>

      <li>say $x ;</li>
    </ol>

    <p>Perl is very nice, tells us which file generated the warning and on which line.</p><b>Only a
    warning</b>

    <p>As I mentioned this is only a warning. If the script has more statements after that say
    statement, they will be executed:</p>

    <ol>
      <li>use warnings ;</li>

      <li>use strict ;</li>

      <li>use 5.010 ;</li>

      <li>my $x ;</li>

      <li>say $x ;</li>

      <li>$x = 42 ;</li>

      <li>say $x ;</li>
    </ol>

    <p>This will print</p>
    <pre>
Use of uninitialized value $x in say at perl_warning_1.pl line 6.

42
</pre><b>Confusing output order</b>

    <p>Beware though, if your code has print statements before the line generating the warning,
    like in this example:</p>

    <ol>
      <li>use warnings ;</li>

      <li>use strict ;</li>

      <li>use 5.010 ;</li>

      <li>print 'OK' ;</li>

      <li>my $x ;</li>

      <li>say $x ;</li>

      <li>$x = 42 ;</li>

      <li>say $x ;</li>
    </ol>

    <p>the result might be confusing.</p>
    <pre>
Use of uninitialized value $x in say at perl_warning_1.pl line 7.
OK
42
</pre>

    <p>Here, 'OK', the result of the print is seen <b>after</b> the warning, even though it was
    called <b>before</b> the code that generated the warning.</p>

    <p>This strangeness is the result of IO buffering . By default Perl buffers STDOUT, the
    standard output channel, while it does not buffer STDERR, the standard error channel.</p>

    <p>So while the word 'OK' is waiting for the buffer to be flushed, the warning message already
    arrives to the screen.</p><b>Turning off buffering</b>

    <p>In order to avoid this you can turn off the buffering of STDOUT.</p>

    <p>This is done by the following code: $| = 1; at the beginning of the script.</p>

    <ol>
      <li>use warnings ;</li>

      <li>use strict ;</li>

      <li>use 5.010 ;</li>

      <li>$ | = 1 ;</li>

      <li>print 'OK' ;</li>

      <li>my $x ;</li>

      <li>say $x ;</li>

      <li>$x = 42 ;</li>

      <li>say $x ;</li>
    </ol>
    <pre>
OKUse of uninitialized value $x in say at perl_warning_1.pl line 7.
42
</pre>

    <p>(The warning is on the same line as the <b>OK</b> because we have not printed a newline \n
    after the OK.)</p><b>The unwanted scope</b>

    <ol>
      <li>use warnings ;</li>

      <li>use strict ;</li>

      <li>use 5.010 ;</li>

      <li>my $x ;</li>

      <li>my $y = 1 ;</li>

      <li>if ( $y ) {</li>

      <li>my $x = 42 ;</li>

      <li>}</li>

      <li>say $x ;</li>
    </ol>

    <p>This code too produces Use of uninitialized value $x in say at perl_warning_1.pl line
    11.</p>

    <p>I have managed to make this mistake several times. Not paying attention I used my $x inside
    the if block, which meant I have created another $x variable, assigned 42 to it just to let it
    go out of the scope at the end of the block. (The $y = 1 is just a placeholder for some real
    code and some real condition. It is there only to make this example a bit more realistic.)</p>

    <p>There are of course cases when I need to declare a variable inside an if block, but not
    always. When I do that by mistake it is painful to find the bug.</p>
 <!--TAGS: .  -->

<!--file:///f:/Public_html/Scripting/Perlorama/Variables/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190910X_use_of_uninitialized_value"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190910X_how_do_i_avoid_an_uninitialized_value" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190910X_how_do_i_check_if_a_perl_scalar_variable_has_been_initialized_stack_overflow"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 10, 2019] <a target="_blank" href="https://stackoverflow.com/questions/6691874/how-do-i-avoid-an-uninitialized-value"> How do   I avoid an uninitialized value</a></h4>

<blockquote>
<h6>Sep 10, 2019 |  <a target="_blank" href= "https://stackoverflow.com/questions/6691874/how-do-i-avoid-an-uninitialized-value">stackoverflow.com</a></h6>
 
 

    <hr noshade align="left" width="10" size="10">

    <p><b><a target="_blank" href="https://stackoverflow.com/users/786441/marto">marto</a></b> ,Jul
    15, 2011 at 16:52</p>

    <blockquote>
      I use this <code>scrub</code> function to clean up output from other functions.
      <pre>
#!/usr/bin/perl
use warnings;
use strict;
use Data::Dumper;

my %h = (
    a => 1,
    b => 1
    );

print scrub($h{c});

sub scrub {
    my $a = shift;

    return ($a eq '' or $a eq '~' or not defined $a) ? -1 : $a;
}
</pre>

      <p>The problem occurs when I also would like to handle the case, where the key in a hash
      doesn't exist, which is shown in the example with <code>scrub($h{c})</code> .</p>

      <p>What change should be make to <code>scrub</code> so it can handle this case?</p>
    </blockquote>

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/users/256439/sandra-schlichting">Sandra Schlichting</a></b> ,Jun 22,
    2017 at 19:00</p>

    <blockquote>
      You're checking whether <code>$a eq ''</code> before checking whether it's defined, hence the
      warning "Use of uninitialized value in string eq". Simply change the order of things in the
      conditional:
      <pre>
return (!defined($a) or $a eq '' or $a eq '~') ? -1 : $a;
</pre>

      <p>As soon as anything in the chain of 'or's matches, Perl will stop processing the
      conditional, thus avoiding the erroneous attempt to compare undef to a string.</p>
    </blockquote>

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/users/256439/sandra-schlichting">Sandra Schlichting</a></b> ,Jul 14,
    2011 at 14:34</p>

    <blockquote>
      In <code>scrub</code> it is too late to check, if the hash has an entry for key
      <code>key</code> . <code>scrub()</code> only sees a scalar, which is <code>undef</code> , if
      the hash key does not exist. But a hash could have an entry with the value <code>undef</code>
      also, like this:
      <pre>
my %h = (
 a => 1,
 b => 1,
 c => undef
);
</pre>

      <p>So I suggest to check for hash entries with the <a target="_blank" href=
      "http://perldoc.perl.org/functions/exists.html"><code>exists</code></a> function.</p>
    </blockquote>
 <!--TAGS: . ~/Scripting -->

<!--file:///f:/Public_html/Scripting/Perlorama/Variables/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>


</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190910X_how_do_i_avoid_an_uninitialized_value"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190910X_how_do_i_check_if_a_perl_scalar_variable_has_been_initialized_stack_overflow" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190910X_perl_multidimensional_array"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 10, 2019] <a target="_blank" href="https://stackoverflow.com/questions/3738836/how-do-i-check-if-a-perl-scalar-variable-has-been-initialized">   How do I check if a Perl scalar variable has been initialized - Stack Overflow</a></h4>

<blockquote>
<h6>Sep 10, 2019 |  <a target="_blank" href= "https://stackoverflow.com/questions/3738836/how-do-i-check-if-a-perl-scalar-variable-has-been-initialized"> stackoverflow.com</a></h6>
 
 

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/questions/3738836/how-do-i-check-if-a-perl-scalar-variable-has-been-initialized">
    How do I check if a Perl scalar variable has been initialized?</a></b> <a target="_blank" href=
    "https://stackoverflow.com/questions/ask">Ask Question</a> Asked 8 years, 11 months ago Active
    <a target="_blank" href=
    "https://stackoverflow.com/questions/3738836/how-do-i-check-if-a-perl-scalar-variable-has-been-initialized?lastactivity">
    3 years ago</a> Viewed 49k times 33 10</p>
    <hr noshade align="left" width="10" size="10">

    <p><b><a target="_blank" href="https://stackoverflow.com/users/2766176/brian-d-foy">brian d
    foy</a></b> ,Sep 18, 2010 at 13:53</p>

    <blockquote>
      Is the following the best way to check if a scalar variable is initialized in Perl, using
      <code>defined</code> ?
      <pre>
my $var;

if (cond) {
    $var = "string1";
}

# Is this the correct way?
if (defined $var) {
    ...
}
</pre>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/168657/mob">mob</a></b> ,Sep 25,
    2010 at 21:35</p>

    <blockquote>
      Perl doesn't offer a way to check whether or not a variable has been initialized.

      <p>However, scalar variables that haven't been explicitly initialized with some value happen
      to have the value of <code>undef</code> by default. You are right about <code>defined</code>
      being the right way to check whether or not a variable has a value of <code>undef</code>
      .</p>

      <p>There's several other ways tho. If you want to assign to the variable if it's
      <code>undef</code> , which your example code seems to indicate, you could, for example, use
      perl's defined-or operator:</p>
      <pre>
$var //= 'a default value';
</pre>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/183181/vol7ron">vol7ron</a></b>
    ,Sep 17, 2010 at 23:17</p>

    <blockquote>
      It depends on what you're trying to do. The proper <code>C</code> way to do things is to
      initialize variables when they are declared; however, <code>Perl is not C</code> , so one of
      the following may be what you want:
      <pre>
  1)   $var = "foo" unless defined $var;      # set default after the fact
  2)   $var = defined $var? $var : {...};     # ternary operation
  3)   {...} if !(defined $var);              # another way to write 1)
  4)   $var = $var || "foo";                  # set to $var unless it's falsy, in which case set to 'foo'
  5)   $var ||= "foo";                        # retain value of $var unless it's falsy, in which case set to 'foo' (same as previous line)
  6)   $var = $var // "foo";                  # set to $var unless it's undefined, in which case set to 'foo'
  7)   $var //= "foo";                        # 5.10+ ; retain value of $var unless it's undefined, in which case set to 'foo' (same as previous line)
</pre>

      <p><br>
      C way of doing things ( <i>not recommended</i> ):</p>
      <pre>
# initialize the variable to a default value during declaration
#   then test against that value when you want to see if it's been changed
my $var = "foo";
{...}
if ($var eq "foo"){
   ... # do something
} else {
   ... # do something else
}
</pre>

      <p>Another long-winded way of doing this is to create a class and a flag when the variable's
      been changed, which is unnecessary.</p>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/11289/axeman">Axeman</a></b>
    ,Sep 17, 2010 at 20:39</p>

    <blockquote>
      If you don't care whether or not it's empty, it is. Otherwise you can check
      <pre>
if ( length( $str || '' )) {}
</pre>
    </blockquote>

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/users/392204/swilliams">swilliams</a></b> ,Sep 17, 2010 at 20:53</p>

    <blockquote>
      It depends on what you plan on doing with the variable whether or not it is defined; as of
      Perl 5.10, you can do this (from <a target="_blank" href=
      "http://search.cpan.org/~rgarcia/perl-5.10.0/pod/perl5100delta.pod#Defined-or_operator">perl51000delta</a>
      ):

      <blockquote>
        <p>A new operator // (defined-or) has been implemented. The following expression:</p>
        <pre>
 $a // $b
</pre>

        <p>is merely equivalent to</p>
        <pre>
defined $a ? $a : $b
</pre>

        <p>and the statement</p>
        <pre>
$c //= $d;
</pre>

        <p>can now be used instead of</p>
        <pre>
$c = $d unless defined $c;
</pre>
      </blockquote>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/54157/rafl">rafl</a></b> ,Jun
    24, 2012 at 7:53</p>

    <blockquote>
      'defined' will return true if a variable has a real value.

      <p>As an aside, in a hash, this can be true:</p>
      <pre>
if(exists $h{$e} && !defined $h{$e})
</pre>
    </blockquote>
 <!--TAGS: . ~/Scripting -->

<!--file:///f:/Public_html/Scripting/Perlorama/Variables/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>


</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190910X_how_do_i_check_if_a_perl_scalar_variable_has_been_initialized_stack_overflow"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190910X_perl_multidimensional_array" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190910X_perl_hashes_javatpoint"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 10, 2019] <a target="_blank" href="https://www.javatpoint.com/perl-multidimensional-array">Perl Multidimensional Array</a></h4>

<blockquote>
<h6>Sep 10, 2019 |  <a target="_blank" href= "https://www.javatpoint.com/perl-multidimensional-array">www.javatpoint.com</a></h6>
 

    <p>The multi dimensional
    array is represented in the form of rows and columns, also called Matrix.</p>

    <p>They can not hold arrays or hashes, they can only hold scalar values. They can contain
    references to another arrays or hashes.</p>
    <hr>
    <b>Perl Multidimensional Array Matrix Example</b>

    <p>Here, we are printing a 3 dimensional matrix by combining three different arrays arr1 , arr2
    and arr3 . These three arrays are merged to make a matrix array final .</p>

    <p>Two for loops are used with two control variables $i and $j .</p>

    <ol>
      <li>## Declaring arrays</li>

      <li>my @arr1 = qw(0 10 0);</li>

      <li>my @arr2 = qw(0 0 20);</li>

      <li>my@arr3 = qw(30 0 0);</li>

      <li>## Merging all the single dimensional arrays</li>

      <li>my @final = (\@arr1, \@arr2, \@arr3);</li>

      <li>print "Print Using Array Index\n" ;</li>

      <li>for (my $i = 0; $i <= $#final; $i ++){</li>

      <li># $#final gives highest index from the array</li>

      <li>for (my $j = 0; $j <= $#final ; $j ++){</li>

      <li>print "$final[$i][$j] " ;</li>

      <li>}</li>

      <li>print "\n" ;</li>

      <li>}</li>
    </ol>

    <p>Output:</p>
    <pre>
Print Using Array Index
0 10 0
0 0 20 
30 0 0
</pre>
    <hr>
    <b>Perl Multidimensional Array Initialization and Declaration Example</b>

    <p>In this example we are initializing and declaring a three dimensional Perl array .</p>

    <ol>
      <li>@ array = (</li>

      <li>[1, 2, 3],</li>

      <li>[4, 5, 6],</li>

      <li>[7, 8, 9]</li>

      <li>);</li>

      <li>for ( $i = 0; $i < 3; $i ++) {</li>

      <li>for ( $j = 0; $j < 3; $j ++) {</li>

      <li>print "$array[$i][$j] " ;</li>

      <li>}</li>

      <li>print "\n" ;</li>

      <li>}</li>
    </ol>
    <textarea name="code" rows="1" cols="20">
@array = (
        [1, 2, 3],
        [4, 5, 6],
        [7, 8, 9]
      );
      for($i = 0; $i < 3; $i++) {
    for($j = 0; $j < 3; $j++) {
        print "$array[$i][$j] ";
   }
   print "\n";
}
</textarea>

    <p>Output:</p>
    <pre>
1 2 3
4 5 6 
7 8 9
</pre>
 <!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_references.shtml-->
<!--file:///f:/Public_html/Scripting/Perlbook/Ch07/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190910X_perl_multidimensional_array"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190910X_perl_hashes_javatpoint" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190910X_pro_perl_debugging"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 10, 2019] <a target="_blank" href="https://www.javatpoint.com/perl-hashes">Perl Hashes - javatpoint</a></h4>

<blockquote>
<h6>Sep 10, 2019 |  <a target="_blank" href="https://www.javatpoint.com/perl-hashes">www.javatpoint.com</a></h6>
 

   <p>The hashes is the most essential and influential part of the perl language. A hash is a group of key-value pairs. The keys are 
   unique strings and values are scalar values.</p>

   <p>Hashes are declared using my keyword. The variable name starts with a (%) sign.</p>

   <p>Hashes are like arrays but there are two differences between them. First arrays are ordered but hashes are unordered. Second, 
   hash elements are accessed using its value while array elements are accessed using its index value.</p>

   <p>No repeating keys are allowed in hashes which makes the key values unique inside a hash. Every key has its single value.</p>

   <p>Syntax:</p>
   <ol>

      <li>my %hashName = (</li>

      <li>"key" => "value" ;</li>

      <li>)</li>
   </ol>
   <textarea name="code1" rows="1" cols="20">
my %hashName = (
        "key" => "value";
)
</textarea>
   <hr><b>Perl Hash Accessing</b>

   <p>To access single element of hash, ($) sign is used before the variable name. And then key element is written inside {} braces.</p>
   <ol>

      <li>my %capitals = (</li>

      <li>"India" => "New Delhi" ,</li>

      <li>"South Korea" => "Seoul" ,</li>

      <li>"USA" => "Washington, D.C." ,</li>

      <li>"Australia" => "Canberra"</li>

      <li>);</li>

      <li>print "$capitals{'India'}\n" ;</li>

      <li>print "$capitals{'South Korea'}\n" ;</li>

      <li>print "$capitals{'USA'}\n" ;</li>

      <li>print "$capitals{'Australia'}\n" ;</li>
   </ol>
   <textarea name="code2" rows="1" cols="20">
my %capitals = (
    "India"  => "New Delhi",
    "South Korea" => "Seoul",
    "USA"  => "Washington, D.C.",
    "Australia"  => "Canberra"
);
print"$capitals{'India'}\n";
print"$capitals{'South Korea'}\n";
print"$capitals{'USA'}\n";
print"$capitals{'Australia'}\n";
</textarea>

   <p>Output:</p>

   <pre>
New Delhi
Seoul
Washington, D.C.
Canberra
</pre>
   <hr><b>Perl Hash Indexing</b>

   <p>Hashes are indexed using $key and $value variables. All the hash values will be printed using a while loop. As the while loop 
   runs, values of each of these variables will be printed.</p>
   <ol>

      <li>my %capitals = (</li>

      <li>"India" => "New Delhi" ,</li>

      <li>"South Korea" => "Seoul" ,</li>

      <li>"USA" => "Washington, D.C." ,</li>

      <li>"Australia" => "Canberra"</li>

      <li>);</li>

      <li># LOOP THROUGH IT</li>

      <li>while (( $key , $value ) = each(%capitals)){</li>

      <li>print $key . ", " . $value . "\n" ;</li>

      <li>}</li>
   </ol>
   <textarea name="code3" rows="1" cols="20">
my %capitals = (
    "India"  => "New Delhi",
    "South Korea" => "Seoul",
    "USA"  => "Washington, D.C.",
    "Australia"  => "Canberra"
);
# LOOP THROUGH IT
while (($key, $value) = each(%capitals)){
     print $key.", ".$value."\n";
}
</textarea>

   <p>Output:</p>

   <pre>
Australia, Canberra
India, New Delhi
USA, Washington, D.C.
South Korea, Seoul
</pre>
   <hr><b>Perl sorting Hash by key</b>

   <p>You can sort a hash using either its key element or value element. Perl provides a sort() function for this. In this example, 
   we'll sort the hash by its key elements.</p>
   <ol>

      <li>my %capitals = (</li>

      <li>"India" => "New Delhi" ,</li>

      <li>"South Korea" => "Seoul" ,</li>

      <li>"USA" => "Washington, D.C." ,</li>

      <li>"Australia" => "Canberra"</li>

      <li>);</li>

      <li># Foreach loop</li>

      <li>foreach $key (sort keys %capitals) {</li>

      <li>print "$key: $capitals{$key}\n" ;</li>

      <li>}</li>
   </ol>
   <textarea name="code4" rows="1" cols="20">
my %capitals = (
    "India"  => "New Delhi",
    "South Korea" => "Seoul",
    "USA"  => "Washington, D.C.",
    "Australia"  => "Canberra"
);
# Foreach loop
foreach $key (sort keys %capitals) {
     print "$key: $capitals{$key}\n";
}
</textarea>

   <p>Output:</p>

   <pre>
Australia: Canberra
India: New Delhi
South Korea: Seoul
USA: Washington: D.C.
</pre>

   <p>Look at the output, all the key elements are sorted alphabetically.</p>
   <hr><b>Perl sorting Hash by its value</b>

   <p>Here we'll sort hash by its value elements.</p>
   <ol>

      <li>my %capitals = (</li>

      <li>"India" => "New Delhi" ,</li>

      <li>"South Korea" => "Seoul" ,</li>

      <li>"USA" => "Washington, D.C." ,</li>

      <li>"UK" => "London"</li>

      <li>);</li>

      <li># Foreach loop</li>

      <li>foreach $value (sort { $capitals { $a } cmp $capitals { $b } }</li>

      <li>keys %capitals)</li>

      <li>{</li>

      <li>print "$value $capitals{$value}\n" ;</li>

      <li>}</li>
   </ol>
   <textarea name="code5" rows="1" cols="20">
my %capitals = (
    "India"  => "New Delhi",
    "South Korea" => "Seoul",
    "USA"  => "Washington, D.C.",
    "UK"  => "London"
);
# Foreach loop
foreach $value (sort {$capitals{$a} cmp $capitals{$b} }
           keys %capitals)
{
     print "$value $capitals{$value}\n";
}
</textarea>

   <p>Output:</p>

   <pre>
UK London
India New Delhi
South Korea Seoul
USA Washington D.C.
</pre>

   <p>Look at the output, all the value elements are sorted alphabetically.</p>
   
   <p>... ... ...</p>
   <hr><b>Perl Removing Hash Elements</b>

   <p>To remove a hash element, use delete() function.</p>

   <p>Here, we have removed both the key-value pairs which were added in the last example.</p>
   <ol>

      <li>my %capitals = (</li>

      <li>"India" => "New Delhi" ,</li>

      <li>"South Korea" => "Seoul" ,</li>

      <li>"USA" => "Washington, D.C." ,</li>

      <li>"Australia" => "Canberra"</li>

      <li>"Germany " => " Berlin"</li>

      <li>" UK " => "London"</li>

      <li>);</li>

      <li>while (( $key , $value ) = each(%apitals)){</li>

      <li>print $key . ", " . $value . "\n" ;</li>

      <li>}</li>

      <li>#removing element</li>

      <li>delete ( $capitals {Germany});</li>

      <li>delete ( $capitals {UK});</li>

      <li># Printing new hash</li>

      <li>print "\n" ;</li>

      <li>while (( $key , $value ) = each(%capitals)){</li>

      <li>print $key . ", " . $value . "\n" ;</li>

      <li>}</li>
   </ol>

   <p>Output:</p>

   <pre>
Australia, Canberra
India, New Delhi
USA, Washington D.C.
South Korea, Seoul
</pre>
   <hr><b>Perl deleting Vs Undefining Hash Elements</b>

   <p>deleting: In deleting, key-value pair will be deleted from the hash.</p>

   <p>Syntax:</p>
   <ol>

      <li>delete ( $hash { $key });</li>
   </ol>
   
   <p>undef: In undef, the value will be undefined but key will remain in the hash.</p>

   <p>Syntax:</p>
   <ol>

      <li>undef $hash { $key }; </li>
   </ol>
 

   <!--TAGS: .  -->

<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190910X_perl_hashes_javatpoint"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190910X_pro_perl_debugging" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190910X_logging_perl_output_the_log_files_stack_overflow"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 10, 2019] <a target="_blank" href="http://books.slashdot.org/article.pl?sid=05/12/12/1448250&from=rss">Pro Perl   Debugging</a></h4>

<blockquote>
<h6>May 12, 2012 |  <a target="_blank" href= "http://books.slashdot.org/article.pl?sid=05/12/12/1448250&from=rss">Slashdot</a></h6>
 

     <p>This title was published in hardcover in March 2005 by Apress, a relatively new member of
    the technical publishing world. The publisher has a 
     <a target="_blank" href=
    "http://www.apress.com/book/bookDisplay.html?bID=399&APRESSESSID=ddc2ba8fbbdaba7b18e180cc70c3324e">Web page</a> for the book that includes links to all of the source code in a Zip file, the
    table of contents in PDF format, and a form for submitting errata. The book comprises 269
    pages, the majority of which are organized into 16 chapters:</p>

     <p>Introduction (not to be confused with the true Introduction immediately preceding
    it),</p>Inspecting Variables and Getting Help, Controlling Program Execution, Debugging a
    Simple Command Line Program, Tracing Execution, Debugging Modules, Debugging Object-Oriented
    Perl, Using the Debugger As a Shell, Debugging a CGI Program, Perl Threads and Forked
    Processes, Debugging Regular Expressions, Debugger Customization, Optimization and Performance
    Hints and Tips, Command Line and GUI Debuggers, Comprehensive Command Reference, Book
    References and URLs.
     <hr noshade align="left" width="10" size="10">

     <p><b><a target="_blank" href="https://slashdot.org/~hattmoward">hattmoward</a>
     <a target=
    "_blank" href="https://slashdot.org/~hattmoward">( 695554 )</a></b> , Monday December 12, 2005
    @02:11PM ( <a target="_blank" href=
    "https://books.slashdot.org/comments.pl?sid=170943&cid=14240507">#14240507</a> )</p>
     <blockquote><a target="_blank" href=
      "https://books.slashdot.org/comments.pl?sid=170943&cid=14240507">Re:In defense of print
      statements</a> ( <a target="_blank" href=
      "https://news.slashdot.org/story/05/12/12/1448250/pro-perl-debugging#">Score: 5</a> ,
      Insightful)

        <p>How many times is that conditional checked at runtime? They can add up. In perl, you
      <i>could</i> have it optimized away at compile time...</p>
        <blockquote><tt>sub DEBUG() { return 1; }</tt>

           <p><tt>...</tt></p>

           <p><tt>DEBUG and print "value of blah:", $blah, $/;</tt></p>
        </blockquote>but... TIMTOWTDI <nobr>
        <wbr></nobr>;)
     </blockquote><b><a target="_blank" href=
    "https://slashdot.org/~Mark_Uplanguage">Mark_Uplanguage</a> <a target="_blank" href=
    "https://slashdot.org/~Mark_Uplanguage">( 444809 )</a></b> , Monday December 12, 2005 @03:13PM
    ( <a target="_blank" href=
    "https://books.slashdot.org/comments.pl?sid=170943&cid=14241006">#14241006</a> )

     <blockquote><a target="_blank" href=
      "https://books.slashdot.org/comments.pl?sid=170943&cid=14241006">Re:In defense of print
      statements</a> ( <a target="_blank" href=
      "https://news.slashdot.org/story/05/12/12/1448250/pro-perl-debugging#">Score: 4</a> ,
      Informative)

        <p>When debugging I emphasize the use of "warn" over "print". It's the same syntax, but the
      warn statements don't get spooled and therefore their timing is quicker.</p>

        <p>This is vital when you code just plain blows up. Using "print" means that a statement
      which got executed before the disaster may not make it to console, thus leading you to
      believe that it never got executed. "warn" avoids this problem and thus leads you to the
      problem more accurately. It also makes it easy to globally comment out the warn statements
      before going releasing the code.</p>
     </blockquote><b><a target="_blank" href="https://slashdot.org/~codyk">codyk</a>
     <a target=
  "_blank" href="https://slashdot.org/~codyk">( 857932 )</a></b> , Monday December 12, 2005
  @03:20PM ( <a target="_blank" href=
  "https://news.slashdot.org/comments.pl?sid=170943&cid=14241071">#14241071</a> )

     <blockquote><a target="_blank" href=
    "https://books.slashdot.org/comments.pl?sid=170943&cid=14241071">Re:In defense of print
    statements</a> ( <a target="_blank" href=
    "https://news.slashdot.org/story/05/12/12/1448250/pro-perl-debugging#">Score: 1</a> )

        <p>Or you could just . . .</p>

        <p>use Smart::Comments;<br>### Expected: "a bunch o stuff" Got: $stuff</p>

        <p>. . . and have debugging statements that are easier to write, can be turned off in one
    place, and don't waste efficiency checking a bunch of conditionals.<br>see 
        <a target="_blank" href=
    "http://search.cpan.org/~dconway/Smart-Comments-1.0.1/lib/Smart/Comments.pm">http://search.cpan.org/~dconway/Smart-Comments-1.
        <nobr>0 
        <wbr></nobr>.1/lib/Smart/Comments.pm</a> [cpan.org]</p>
     </blockquote><b><a target="_blank" href="https://slashdot.org/~licamell">licamell</a>
     <a target=
  "_blank" href="https://slashdot.org/~licamell">( 778753 )</a>
     <a target="_blank" href=
  "https://news.slashdot.org/faq/subscriptions.shtml#subscription_other_advantages">*</a></b> ,
  Monday December 12, 2005 @01:47PM ( 
     <a target="_blank" href=
  "https://books.slashdot.org/comments.pl?sid=170943&cid=14240302">#14240302</a> )

     <blockquote><a target="_blank" href=
    "https://books.slashdot.org/comments.pl?sid=170943&cid=14240302">use strict and
    Data::Dumper!</a> ( <a target="_blank" href=
    "https://news.slashdot.org/story/05/12/12/1448250/pro-perl-debugging#">Score: 5</a> ,
    Insightful)

        <p>#! <nobr>
        <wbr></nobr>/usr/local/bin/perl<br>#<br># Two things that make debugging perl easy:<br>#</p>

        <p>use strict;<br>use Data::Dumper; ›</p>
     </blockquote><b><a target="_blank" href="https://slashdot.org/~Baron+von+Leezard">Baron von
  Leezard</a> <a target="_blank" href="https://slashdot.org/~Baron+von+Leezard">( 675918 )</a></b>
  , Monday December 12, 2005 @03:22PM ( 
     <a target="_blank" href=
  "https://news.slashdot.org/comments.pl?sid=170943&cid=14241092">#14241092</a> )

     <blockquote><a target="_blank" href=
    "https://books.slashdot.org/comments.pl?sid=170943&cid=14241092">Re:use strict and
    Data::Dumper!</a> ( <a target="_blank" href=
    "https://news.slashdot.org/story/05/12/12/1448250/pro-perl-debugging#">Score: 1</a> )

        <p>[That's one freelance Perl programmer I'll have to remember never to hire.]</p>

        <p>Seriously, I'm one of those people who use a debugger every day. Actually, when I write new
    code in Perl, often the first thing I do is step through it in the debugger to make sure it
    does what I think it should. Especially in Perl, it is very easy to accidentally do something
    that's a little off. With the "wait until something goes wrong before I investigate" attitude
    demonstrated here, you'll never know anything is amiss until some nasty bug crops up as a
    result. Using the debugger to sanity check my code means that I catch most bugs before they
    ever cause problems.</p>

        <p>I'm sure I'm going to get some snide remarks about this approach, but really, I've been a
    serious Perl programmer for about eight years now, and often write moderately complex Perl
    programs that work perfectly the first time--run through the debugger or not. I can't say that
    about any other language, and it's something most people can't say about any language, let
    alone Perl ;)</p>
     </blockquote>
     
 <!--TAGS: . ~/Perl2 -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_debugging.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190910X_pro_perl_debugging"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190910X_logging_perl_output_the_log_files_stack_overflow" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190906X_did_cia_director_william_casey_really_say_we_ll_know_our_disinformation_program_is"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 10, 2019] <a target="_blank" href="https://stackoverflow.com/questions/32244474/perl-output-the-log-files">logging - Perl - Output   the log files - Stack Overflow</a></h4>

<blockquote>
<h6>Aug 27, 2015 |  <a target="_blank" href= "https://stackoverflow.com/questions/32244474/perl-output-the-log-files">stackoverflow.com</a></h6>
 
 

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/questions/32244474/perl-output-the-log-files">Perl - Output the log
    files</a></b> <a target="_blank" href="https://stackoverflow.com/questions/ask">Ask
    Question</a> Asked 4 years ago Active <a target="_blank" href=
    "https://stackoverflow.com/questions/32244474/perl-output-the-log-files?lastactivity">4 years
    ago</a> Viewed 3k times 1 2</p>
    <hr noshade align="left" width="10" size="10">

    <p><b><a target="_blank" href="https://stackoverflow.com/users/1604311/arunesh-singh">Arunesh
    Singh</a></b> ,Aug 27, 2015 at 8:53</p>

    <blockquote>
      I have created a perl that telnet to multiple switches. I would like to check if telnet
      functions properly by telneting the switch.

      <p>This is my code to telnet to the switches:</p>
      <pre>
#!/usr/bin/perl
use warnings;
use Net::Cisco;

open( OUTPUT, ">log.txt" );
open( SWITCHIP, "ip.txt" ) or die "couldn't open ip.txt";

my $count = 0;

while (<SWITCHIP>) {
    chomp($_);
    my $switch = $_;
    my $tl     = 0;
    my $t      = Net::Telnet::Cisco->new(
        Host => $switch,
        Prompt =>
            '/(?m:^(?:[\w.\/]+\:)?[\w.-]+\s?(?:\(config[^\)]*\))?\s?[\$#>]\s?(?:\(enable\))?\s*$)/',
        Timeout => 5,
        Errmode => 'return'
    ) or $tl = 1;

    my @output = ();
    if ( $tl != 1 ) {
        print "$switch Telnet success\n";
    }
    else {
        my $telnetstat = "Telnet Failed";
        print "$switch $telnetstat\n";
    }
    close(OUTPUT);
    $count++;
}
</pre>

      <p>This is my output status after I was testing 7 switches:</p>
      <pre>
10.xxx.3.17 Telnet success
10.xxx.10.12 Telnet success
10.xxx.136.10 Telnet success
10.xxx.136.12 Telnet success
10.xxx.188.188 Telnet Failed
10.xxx.136.13 Telnet success
</pre>

      <p>I would like to convert the telnet result as log file.<br>
      How to separate successful and failed telnet results by using perl?</p>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/4944038/danny-luk">Danny
    Luk</a></b> ,Aug 28, 2015 at 8:40</p>

    <blockquote>
      Please Try the following
      <pre>
#!/usr/bin/perl
use warnings;
use Net::Cisco;
################################### S
open( OUTPUTS, ">log_Success.txt" );
open( OUTPUTF, ">log_Fail.txt" );
################################### E
open( SWITCHIP, "ip.txt" ) or die "couldn't open ip.txt";

my $count = 0;

while (<SWITCHIP>) {
    chomp($_);
    my $switch = $_;
    my $tl     = 0;
    my $t      = Net::Telnet::Cisco->new(
        Host => $switch,
        Prompt =>
            '/(?m:^(?:[\w.\/]+\:)?[\w.-]+\s?(?:\(config[^\)]*\))?\s?[\$#>]\s?(?:\(enable\))?\s*$)/',
        Timeout => 5,
        Errmode => 'return'
    ) or $tl = 1;

    my @output = ();
################################### S
    if ( $tl != 1 ) {
        print "$switch Telnet success\n"; # for printing it in screen
        print OUTPUTS "$switch Telnet success\n"; # it will print it in the log_Success.txt
    }
    else {
        my $telnetstat = "Telnet Failed";
        print "$switch $telnetstat\n"; # for printing it in screen
        print OUTPUTF "$switch $telnetstat\n"; # it will print it in the log_Fail.txt
    }
################################### E
    $count++;
}
################################### S
close(SWITCHIP);
close(OUTPUTS);
close(OUTPUTF);
################################### E
</pre>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/4944038/danny-luk">Danny
    Luk</a></b> ,Aug 28, 2015 at 8:39</p>

    <blockquote>
      In print statement after print just write the filehandle name which is <code>OUTPUT</code> in
      your code:
      <pre>
print OUTPUT "$switch Telnet success\n";
</pre>

      <p>and</p>
      <pre>
print OUTPUT "$switch $telnetstat\n";
</pre>

      <p>A side note: always use a lexical filehandle and three arguments with error handling to
      open a file. This line <code>open(OUTPUT, ">log.txt");</code> you can write like this:</p>
      <pre>
open my $fhout, ">", "log.txt" or die $!;
</pre>
    </blockquote>

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/users/2566198/sobrique">Sobrique</a></b> ,Aug 28, 2015 at 8:39</p>

    <blockquote>
      Use <a target="_blank" href="http://perldoc.perl.org/Sys/Syslog.html">Sys::Syslog</a> to
      write log messages.

      <p>But since you're opening a <code>log.txt</code> file with the handle <code>OUTPUT</code> ,
      just change your two <code>print</code> statements to have <code>OUTPUT</code> as the first
      argument and the string as the next (without a comma).</p>
      <pre>
my $telnetstat;
if($tl != 1) {
  $telnetstat = "Telnet success";
} else {
  $telnetstat = "Telnet Failed";
}
print OUTPUT "$switch $telnetstat\n";

# Or the shorter ternary operator line for all the above:
print OUTPUT $swtich . (!$tl ? " Telnet success\n" : " Telnet failed\n");
</pre>

      <p>You might consider moving <code>close</code> to an <code>END</code> block:</p>
      <pre>
END {
  close(OUTPUT);
}
</pre>

      <p>Not only because it's in your <code>while</code> loop.</p>
    </blockquote>
 
<!--TAGS: . ~/Scripting -->
 <!--file:///f:/Public_html/Scripting/Perlorama/Logging/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>


</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190910X_logging_perl_output_the_log_files_stack_overflow"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190906X_did_cia_director_william_casey_really_say_we_ll_know_our_disinformation_program_is" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190906X_the_fact_that_our_leaders_continue_to_put_our_brave_young_men_and_women_in_harm_s"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 06, 2019] <a target="_blank" href="https://www.quora.com/Did-CIA-Director-William-Casey-really-say-Well-know-our-disinformation-program-is-complete-when-everything-the-American-public-believes-is-false">   Did CIA Director William Casey really say, "We'll know our disinformation program is complete   when everything the American public believes is false"?</a></h4>

<blockquote>
<h6>Sep 06, 2019 |  <a target="_blank" href= "https://www.quora.com/Did-CIA-Director-William-Casey-really-say-Well-know-our-disinformation-program-is-complete-when-everything-the-American-public-believes-is-false"> www.quora.com</a></h6>
 

    <p><a target="_blank" href="https://www.quora.com/profile/Matt-Egan-26">Matt Egan</a> , former
    US Intelligence Officer (1967-2006) <a target="_blank" href=
    "https://www.quora.com/Did-CIA-Director-William-Casey-really-say-Well-know-our-disinformation-program-is-complete-when-everything-the-American-public-believes-is-false/answer/Matt-Egan-26">
    Answered Sep 8, 2017</a> · Author has 4.8k answers and 2.3m answer views</p>

    <blockquote>

       <p>It does appear he said something very much along those lines, though I doubt it meant what
    it appears to mean absent the context. He made the statement not long after he became the
    Director of Central Intelligence, during a discussion of the fact that, to his amazement, about
    80 percent of the contents of typical CIA intelligence publications was based on information
    from open, unclassified sources, such as newspapers and magazines. </p>

       <p>Apparently, and reasonably,
    he judged that about the same proportion of Soviet intelligence products was probably based on
    open sources, as well. That meant that CIA disinformation programs directed at the USSR
    wouldn't work unless what was being disseminated by US magazines and newspapers on the same
    subjects comported with what the CIA was trying to sell the Soviets. </p>

       <p>Given that the CIA could
    not possibly control the access to open sources of all US publications, the subjects of CIA
    disinformation operations had to be limited to topics not being covered by US public media. To
    be sure, some items of disinformation planted by the CIA in foreign publications might
    subsequently be discovered and republished by US media. I'm guessing the CIA would not leap to
    correct those items.</p>

       <p>But that is a far cry from concluding that the CIA would (or even could) arrange that
    "everything the American public believes is false."</p>
    </blockquote>
    
 <!--TAGS: . ~/Perl -->
 <!--file:///f:/Public_html/Skeptics/Political_skeptic/Propaganda/real_war_on_reality.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Propaganda/index.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/index.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Bulletin/political_skeptic2019.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Propaganda/Bulletin/propaganda2019.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190906X_did_cia_director_william_casey_really_say_we_ll_know_our_disinformation_program_is"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190906X_the_fact_that_our_leaders_continue_to_put_our_brave_young_men_and_women_in_harm_s" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190902X_perlcperl_a_perl5_with_classes_types_compilable_company_friendly"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 06, 2019] <a target="_blank" href="https://www.quora.com/Did-CIA-Director-William-Casey-really-say-Well-know-our-disinformation-program-is-complete-when-everything-the-American-public-believes-is-false">                                                                   The fact that our "leaders" continue to put our brave young men                                                                    and women in harm's way, as we also kill millions of "others", and                                                                    the American people stand idly by, is a proof of Casey quote . "So and                                                                    so is evil and he oppresses his people, so we need to remove him                                                                    and bring democracy to such and such country!" </a></h4>

<h5>Notable quotes:</h5>
<h5>"...  You've heard of the "Manchurian                                                                 Candidate"? We are the "Manchurian Populace". They spout the                                                                 aforementioned mantra, and we all turn into mindless followers ..."</h5>
<h5>"...  Assume that CIA launched disinformation in a hostile country to impact them. Then international news agencies picked it up     and it got published by media in the US. If the disinformation were harmless to the US, then our Federal Government would not     comment and would let the disinformation stand. To repudiate it might have bad effects on national security. Would this be a case     of the CIA lying to the American people? No.  ..."</h5>
<h5>"...  The CIA once had influence in a number of English language                                                                 publications abroad, some of which stories were reprinted in the US                                                                 media. This was known as "blowback", and unintended in most cases.     ..."</h5>
<h5>"...  The CIA fabricated a story that the Russians in Afghanistan made plastic bombs in the shape of toys, to blow up children.     Casey repeated this story, knowing it to be disinformation, as fact to US journalists and politicians.  ..."</h5>
<h5>"...  He doesn't need to have said it.                                                                 CIA has run many disinformation campaigns against American public.     Operation Mockingbird  ..."</h5>
<blockquote>
<h6>Sep 06, 2019 |  <a target="_blank" href="https://www.quora.com/Did-CIA-Director-William-Casey-really-say-Well-know-our-disinformation-program-is-complete-when-everything-the-American-public-believes-is-false">www.quora.com </a> </h6>
 
<hr noshade align="left" width="10" size="10">
<p>
<b>
<a target="_blank" href="https://www.quora.com/profile/Thommy-Berlin">
                                                                                          Thommy Berlin
</a></b>
<blockquote>

   <p>Not that it matters. No conservative I know retains the ability to 
                                                               think off script, let alone rise above his indoctrination, and 
                                                               neither the script or their indoctrination allows this to be real.

   <p>So as far as they're concerned, it simply isn't possible.

   <p>Neither was David Stockman's admission that the idea of 'trickle 
                                                               down' was to bankrupt the federal government so they could finally do 
                                                               away with social security, while making themselves filthy rich...

   <p>Or Reagan being a traitor for negotiating with the Iranians BEFORE he 
                                                               was elected....

   <p>Or Bush II stealing the 2000 election....

   <p>Well...it's a LONG list....
</blockquote>
<p>
<a target="_blank" href="https://www.quora.com/profile/Rael-Sackey">
                                                                        <b>Rael Sackey</b>
</a>
<a target="_blank" href="https://www.quora.com/Did-CIA-Director-William-Casey-really-say-Well-know-our-disinformation-program-is-complete-when-everything-the-American-public-believes-is-false/answer/Rael-Sackey">
                                                                        Answered Mar 16, 2019
</a>
<blockquote>

   <p>The fact that our 
                                                               "leaders" continue to put our brave young men and women in harm's 
                                                               way, as we also kill millions of "others", and the American people 
                                                               stand idly by, is proof enough for me. "So and so is evil and he 
                                                               oppresses his people, so we need to remove him and bring democracy to 
                                                               such and such country!" This has been the game plan for decades. In 
                                                               the info age we know all this. 

   <p>A convicted war criminal like Eliot 
                                                               Abrams is hired by a president the media and the Democrats hate and 
                                                               call a liar, and we suddenly suspend our disbelief, and follow 
                                                               blindly into another regime change war while we are buddies with many 
                                                               dictators around the world. 

   <p><em>You've heard of the "Manchurian 
                                                               Candidate"? We are the "Manchurian Populace". They spout the 
                                                               aforementioned mantra, and we all turn into mindless followers</em> of 
                                                               these MONSTERS!

                                                               806 views
 · <a target="_blank" href="https://www.quora.com/Did-CIA-Director-William-Casey-really-say-Well-know-our-disinformation-program-is-complete-when-everything-the-American-public-believes-is-false#">View 3 Upvoters
   </a>
</blockquote>

<p><b><a target="_blank" href="https://www.quora.com/profile/Don-Harmon-4">
                                                                        Don Harmon</a></b>, 
                                                                        former intell analyst, former coll. poli sci professor. 
                                                                        (1999-2013)
<a target="_blank" href="https://www.quora.com/Did-CIA-Director-William-Casey-really-say-Well-know-our-disinformation-program-is-complete-when-everything-the-American-public-believes-is-false/answer/Don-Harmon-4">
                                                                        Answered Jan 21, 2017
</a>
 ·<blockquote>

   <p>About two years 
                                                               ago, one Barbara Honneger said in Quora that she was there. But I can 
                                                               find no credible news source that affirms this. </p>

   <p>It is possible 
                                                               that Director Casey said it without any negative significance for the 
                                                               American people.
<b>How?
</b></p>

   <p><em>Assume that CIA launched disinformation in a hostile country to impact them. Then international news agencies picked it up 
   and it got published by media in the US. If the disinformation were harmless to the US, then our Federal Government would not 
   comment and would let the disinformation stand. To repudiate it might have bad effects on national security. Would this be a case 
   of the CIA lying to the American people? No. </em>
</blockquote>

<p>
                                                               <b>
<a target="_blank" href="https://www.quora.com/profile/Fred-Landis">
                                                                        Fred Landis</a></b>, 
                                                                        Investigative Reporter
<a target="_blank" href="https://www.quora.com/Did-CIA-Director-William-Casey-really-say-Well-know-our-disinformation-program-is-complete-when-everything-the-American-public-believes-is-false/answer/Fred-Landis">
                                                                        Answered Sep 10, 2013
</a>
                                                               ·
<blockquote>

   <p><em>The CIA once had influence in a number of English language 
                                                               publications abroad, some of which stories were reprinted in the US 
                                                               media. This was known as "blowback", and unintended in most cases.
   </em>

   <p><em>The CIA fabricated a story that the Russians in Afghanistan made plastic bombs in the shape of toys, to blow up children. 
   Casey repeated this story, knowing it to be disinformation, as fact to US journalists and politicians. </em>
</blockquote>

<p><b>
<a target="_blank" href="https://www.quora.com/profile/Ozgur-Zeren">
                                                                        Ozgur Zeren
</a>
</b>, 
                                                                        Author at ViaPopuli.com
<a target="_blank" href="https://www.quora.com/Did-CIA-Director-William-Casey-really-say-Well-know-our-disinformation-program-is-complete-when-everything-the-American-public-believes-is-false/answer/Ozgur-Zeren">
                                                                        Answered Oct 22, 2014</a><blockquote>

   <p><em>He doesn't need to have said it. 
                                                               CIA has run many disinformation campaigns against American public.
   <a target="_blank" href="http://en.wikipedia.org/wiki/Operation_Mockingbird">Operation Mockingbird
</em></a>
</blockquote>


<!--TAGS: . ~/Perl -->

<!--file:///f:/Public_html/Skeptics/Political_skeptic/Propaganda/real_war_on_reality.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Propaganda/index.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/index.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Bulletin/political_skeptic2019.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Propaganda/Bulletin/propaganda2019.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190906X_the_fact_that_our_leaders_continue_to_put_our_brave_young_men_and_women_in_harm_s"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190902X_perlcperl_a_perl5_with_classes_types_compilable_company_friendly" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190902X_this_perl_goes_to_11"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 02, 2019] <a target="_blank" href="http://perl11.org/cperl/">perlcperl - a perl5 with   classes, types, compilable, company friendly</a></h4>

<blockquote>
<h6>Sep 02, 2019 |  <a target="_blank" href="http://perl11.org/cperl/">perl11.org</a></h6>
 

    <p><b>Compile-time optimizations</b></p>

    <p>cperl adds many more traditional compile-time optimizations: more and earlier constant
    folding, type promotions, shaped arrays, usage of literal and typed constants, loop unrolling,
    omit unnecessary array bounds checks, function inlining and conversion of static method calls
    to functions.</p>

    <p>Perl 5 only inlines constant function bodies with an explicit empty <code>()</code>
    prototype.</p>
    <pre>
    sub x() {1+2} # inlined in perl5
    sub x   {1+2} # inlined in cperl only
</pre>

    <p>cperl inlines constant function bodies even without empty prototype declaration, has type
    declarations for most internal ops, and optimizes these ops depending on the argument types;
    currently for all arithmetic unops and binops, and the data-accessing ops padsv, svop, and
    sassign. <i>opnames.h</i> stores <code>PL_op_type_variants</code> , all possible type
    promotions for each op. <i>opcode.h</i> stores <code>PL_op_type</code> with the type
    declarations of all ops.</p>
 <!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190902X_perlcperl_a_perl5_with_classes_types_compilable_company_friendly"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190902X_this_perl_goes_to_11" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190902X_how_to_get_the_current_line_number_of_a_file_open_using_perl"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 02, 2019] <a target="_blank" href="http://perl11.org/">This Perl Goes To 11</a></h4>

<blockquote>
<h6>Sep 02, 2019 |  <a target="_blank" href="http://perl11.org/">perl11.org</a></h6>
 

    <p>Perl 11 is not (yet) an actual version of Perl; rather, Perl 11 is currently a philosophy
    with 3 primary tenets:</p>

    <ul>
      <li>1. Pluggability Of Perl On All Levels</li>

      <li>2. Reunification Of Perl 5 & Perl 6</li>

      <li>3. Runtime Performance Of C/C++ Or Faster</li>
    </ul>

    <p>Perl 11 promotes ideas which will make Perl 5 pluggable at the following levels:</p>

    <ul>
      <li>Runtime Virtual Machine</li>

      <li>Compilation Unit Format / AST</li>

      <li>Source Code Syntax / Compilers</li>
    </ul>

    <p>This will open up the doors to many kinds of language / technology experimentation, without
    endangering the existing Perl 5 / CPAN code bases that we depend on every day.</p>

    <p>Pluggable VMs would be parrot, p2, JVM or .NET running Perl5 and Perl 6 code. 5 + 6 ==
    11!</p><b>Perl 11 Projects</b>

    <p>The following projects are important in reaching the vision of Perl 11:</p><b>RPerl</b>

    <p>A Restricted Perl by Will Braswell which translates a medium-magic subset of Perl 5 into
    C/C++ using Inline::C and Inline::CPP</p>

    <ul>
      <li><a target="_blank" href="http://www.rperl.org/">rperl.org</a></li>
    </ul><b>cperl</b>

    <p>cperl is an improved variant of perl5, running all of perl5 and CPAN code. With many perl6
    features, just faster.<br>
    Faster than perl5 and perl6. It is stable and usable, but still in development with many more
    features being added soon.</p>

    <ul>
      <li><a target="_blank" href="http://perl11.org/cperl/">perl11.org/cperl/</a></li>

      <li><a target="_blank" href="http://perl11.org/cperl/STATUS.html">STATUS</a></li>
    </ul>

    <p>... ... ...</p><b>Perl 11 Links</b>

    <ul>
      <li><a target="_blank" href="http://cloudforfree.org/">CloudForFree.org</a> Runs RPerl</li>

      <li><a target="_blank" href="http://austin.pm/">Austin Perl Mongers</a> Supports Perl 11</li>
    </ul>
 <!--TAGS: .  -->
 <!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190902X_this_perl_goes_to_11"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190902X_how_to_get_the_current_line_number_of_a_file_open_using_perl" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190828X_logprograminfo_a_perl_module_to_collect_and_log_data_for_bioinformatics_pipelines"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Sep 02, 2019] <a target="_blank" href="https://stackoverflow.com/questions/5920686/how-to-get-the-current-line-number-of-a-file-open-using-perl">   How to get the current line number of a file open using Perl</a></h4>

<blockquote>
<h6>Sep 02, 2019 |  <a target="_blank" href= "https://stackoverflow.com/questions/5920686/how-to-get-the-current-line-number-of-a-file-open-using-perl"> stackoverflow.com</a></h6>
 

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/questions/5920686/how-to-get-the-current-line-number-of-a-file-open-using-perl">
    How to get the current line number of a file open using Perl?</a></b> <a target="_blank" href=
    "https://stackoverflow.com/questions/ask">Ask Question</a> Asked 8 years, 3 months ago Active
    <a target="_blank" href=
    "https://stackoverflow.com/questions/5920686/how-to-get-the-current-line-number-of-a-file-open-using-perl?lastactivity">
    6 months ago</a> Viewed 33k times 25 1</p>
    <hr noshade align="left" width="10" size="10">

    <p><b><a target="_blank" href="https://stackoverflow.com/users/579432/tadmc">tadmc</a></b> ,May
    8, 2011 at 17:08</p>

    <blockquote>
      <pre>
open my $fp, '<', $file or die $!;

while (<$fp>) {
    my $line = $_;
    if ($line =~ /$regex/) {
        # How do I find out which line number this match happened at?
    }
}

close $fp;
</pre>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/471272/tchrist">tchrist</a></b>
    ,Apr 22, 2015 at 21:16</p>

    <blockquote>
      Use <code>$.</code> (see <a target="_blank" href=
      "http://perldoc.perl.org/perlvar.html"><code>perldoc perlvar</code></a> ).
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/471272/tchrist">tchrist</a></b>
    ,May 7, 2011 at 16:48</p>

    <blockquote>
      You can also do it through OO interface:
      <pre>
use IO::Handle;
# later on ...
my $n = $fp->input_line_number();
</pre>

      <p>This is in <a target="_blank" href="http://perldoc.perl.org/perlvar.html">perldoc
      perlvar</a> , too.</p>
    </blockquote>

    <p><b>></b> ,</p>

    <blockquote>
      <a target="_blank" href="https://stackoverflow.com/a/20020550/4970442">Don't use</a>
      <code>$.</code> , nor <code>$_</code> or any global variable. Use this instead:
      <pre>
while(my $line = <FILE>) {
  print $line unless ${\*FILE}->input_line_number == 1;
}
</pre>

      <p>To avoid this and a lot of others Perl gotchas you can use on Atom or VSCode packages like
      <a target="_blank" href="https://atom.io/packages/linter-perl">linter-perl</a> . Stop making
      Perl <a target="_blank" href="https://en.wikipedia.org/wiki/Write-only_language">a write-only
      language</a> !</p>
    </blockquote>
 <!--TAGS: . ~/Scripting -->
 <!--file:///f:/Public_html/Scripting/Perlorama/File_operations/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190902X_how_to_get_the_current_line_number_of_a_file_open_using_perl"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190828X_logprograminfo_a_perl_module_to_collect_and_log_data_for_bioinformatics_pipelines" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190828X_echo_command_in_linux_with_examples"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Aug 28, 2019] <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/">LogProgramInfo A Perl module to collect  and log data for bioinformatics pipelines</a></h4>

<blockquote>
<h6>Aug 28, 2019 |  <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/">nlm.nih.gov</a></h6>
 
   Find articles by
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pubmed/?term=Macdonald%20JM%5BAuthor%5D&cauthor=true&cauthor_uid=27347003">
   John M. Macdonald</a> <b>Paul C. Boutros</b>

   <p>Informatics and Biocomputing Program, Ontario Institute for Cancer Research, Suite 510, MaRS Centre, 661 University Ave, Toronto, 
   Ontario Canada</p>

   <p>Departments of Medical Biophysics and Pharmacology & Toxicology, University of Toronto, Toronto, Ontario Canada</p>
   Find articles by
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pubmed/?term=Boutros%20PC%5BAuthor%5D&cauthor=true&cauthor_uid=27347003">Paul 
   C. Boutros</a> <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#">Author information</a>
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#">Article notes</a>
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#">Copyright and License information</a>
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/about/disclaimer/">Disclaimer</a> Informatics and Biocomputing Program, 
   Ontario Institute for Cancer Research, Suite 510, MaRS Centre, 661 University Ave, Toronto, Ontario Canada Departments of Medical 
   Biophysics and Pharmacology & Toxicology, University of Toronto, Toronto, Ontario Canada John M. Macdonald, Email:
   <a data-email="ac.no.rcio@dlanodcam.nhoj" href="mailto:dev@null">ac.no.rcio@dlanodcam.nhoj</a> .
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#idm140320254303904aff-info">Contributor Information</a> 
   . <sup><img alt="corresponding author" src="https://www.ncbi.nlm.nih.gov/corehtml/pmc/pmcgifs/corrauth.gif"></sup> Corresponding 
   author. <sup>#</sup> Contributed equally. Received 2015 Nov 26; Accepted 2016 Jun 1.
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/about/copyright/">Copyright</a> © The Author(s) 2016

   <p>Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (
   <a target="_blank" href="http://creativecommons.org/licenses/by/4.0/">http://creativecommons.org/licenses/by/4.0/</a> ), which permits 
   unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and 
   the source, provide a link to the Creative Commons license, and indicate if changes were made. The Creative Commons Public Domain 
   Dedication waiver ( <a target="_blank" href="http://creativecommons.org/publicdomain/zero/1.0/">http://creativecommons.org/publicdomain/zero/1.0/</a> 
   ) applies to the data made available in this article, unless otherwise stated.
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#">Go to:</a> </p>

   <p><b>Abstract</b> <b>Background</b> </p>

   <p>To reproduce and report a bioinformatics analysis, it is important to be able to determine the environment in which a program 
   was run. It can also be valuable when trying to debug why different executions are giving unexpectedly different results. </p>

   <p><b>Results</b></p>

   <p>Log::ProgramInfo is a Perl module that writes a log file at the termination of execution of the enclosing program, to document 
   useful execution characteristics. This log file can be used to re-create the environment in order to reproduce an earlier execution. 
   It can also be used to compare the environments of two executions to determine whether there were any differences that might affect 
   (or explain) their operation.</p>

   <p> <b>Availability</b></p>

   <p>The source is available on CPAN (Macdonald and Boutros, Log-ProgramInfo.
   <a target="_blank" href="http://search.cpan.org/~boutroslb/Log-ProgramInfo/">http://search.cpan.org/~boutroslb/Log-ProgramInfo/</a> 
   ). </p>

   <p><b>Conclusion</b></p>

   <p>Using Log::ProgramInfo in programs creating result data for publishable research, and including the Log::ProgramInfo output log 
   as part of the publication of that research is a valuable method to assist others to duplicate the programming environment as a precursor 
   to validating and/or extending that research. Keywords: Reproducibility, Log, Environment
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#">Go to:</a> <b>Background</b></p>

   <p>Reproducibility is a major concern in science as a whole, and computational biology in particular. For reproducibility, it is 
   not sufficient to provide access to the raw data -- it is ever more critical to also provide access to the program code used to analyse 
   those data [ <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#CR2">2</a> ]. But <i>the program code</i> 
   is a dynamic mixture of program text, command line arguments, libraries, and various other environmental aspects -- all of which 
   may need to be exactly reproduced to achieve the same results. So, simply providing access to the code used is not a complete solution. 
   It is necessary, but not sufficient.</p>

   <p>The need for reproducibility is growing because our pipelines are getting increasingly complex: a typical sequencing pipeline 
   might involve a chain of a dozen unique tools [
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#CR3">3</a> ]. But reproducing these pipelines is fundamentally 
   very difficult, in part because it requires duplicating the versions of all dependent tools and libraries used in an analysis. Given 
   the rapid rate of release of updates to common tools (e.g. BWA had 7 updates during the course of 2014 [
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#CR4">4</a> ], this can be a significant challenge.</p>

   <p>Among the best practices for scientific computing (e.g. [
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#CR5">5</a> ]) is listed the need to collect and publish:</p>
   <ul>

      <li>

      <p>Unique identifiers and version numbers for programs and libraries;</p>
      </li>

      <li>

      <p>The values of parameters used to generate any given output; and</p>
      </li>

      <li>

      <p>The names and version numbers of programs (however small) used to generate those outputs.</p>
      </li>
   </ul>

   <p>A large fraction of pipelines for bioinformatics are written in the Perl programming language (e.g. BioPerl [
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#CR6">6</a> ]). However, for logging the precise state 
   of a program at run-time, and capturing all the dependency versions and other key information, there are no automated choices available.</p>

   <p>To resolve this issue, we introduce here the module Log::ProgramInfo to facilitate run-time logging of Perl-based pipelines, thereby 
   directly improving the reproducibility of modern bioinformatic analyses.</p>

   <p>A further advantage to such tracking information is the ability to test an analsis using later versions of the component tools 
   to determine whether they provide different results (possibly more accurate if the later releases provide better resolution; possibly 
   identifying erroneous results in the original analysis if the tools have been updated with critical fixes to their operation).
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#">Go to:</a> </p>

   <p><b>Related work</b></p>

   <p>A search found some programs for related processes but nothing that served the same purposes.</p>

   <p>There are some programs available to collect and document the computing process - by recording the steps invoved, including command 
   lines and arguments during the actual data processing. Such a program could work well together with the described module but addresses 
   a different aspect of the reproducibility issue. In our lab, when the workflow of the data analysis was sufficiently complex to require 
   such a description, we instead write a program to encapsulate that process, so there is no long list of manual processing steps to 
   document.</p>

   <p>In particular, the program (ReproZip) [ <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#CR7">7</a> 
   ] was capable of discovering and bundling together all of the programs used during the execution of a process. That seems to have 
   different trade-offs. Such a bundle is only useful on similar hardware and it provides no possibility for assisting with script library 
   version info, or in allowing a later run to use selected variations on the programming environment (such as allowing updated versions 
   of programs that still have the same function but have had security problems fixed).
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#">Go to:</a> <b>Implementation</b></p>

   <p>The Log::ProgramInfo module Macdonald and Boutros, Log-ProgramInfo.
   <a target="_blank" href="http://search.cpan.org/~boutroslb/Log-ProgramInfo/">http://search.cpan.org/~boutroslb/Log-ProgramInfo/</a> 
   is available as open source, and has been distributed on CPAN (the Comprehansive Perl Archive Network - used as the standard distribution 
   mechanism for the vast majority of open source Perl modules, and described in the Perl documentation with the command "perldoc perlmodinstall").</p>

   <p>Log::ProgramInfo is enabled simply by being included with a Perl use statement. Since its effect is global to the program, it 
   should be enabled directly from the main program, or from a utility module that contains global configuration settings for a suite 
   of programs.</p>

   <p>Any desired setting of non-default values for the options can be provided either through environment variables, or as "import" 
   list options.</p>

   <p>When the module is used for the first time, the loading process carries out a number of actions for its operation:</p>
   <ul>

      <li>

      <p>- An END block is created. It will be executed when the program terminates, to write out the log information.</p>
      </li>

      <li>

      <p>- Signal handlers are installed for catcheable signals - if one of them occurs, the log information will be printed out before 
      the program terminates.</p>
      </li>

      <li>

      <p>- options are set to their default values</p>
      </li>

      <li>

      <p>- any env variables to control options are saved</p>
      </li>

      <li>

      <p>- a copy is made of the original command line arguments for eventual logging</p>
      </li>

      <li>

      <p>- the start time is recorded for eventual logging</p>
      </li>

      <li>

      <p>-... (numerous other system attributes are saved for eventual logging)</p>
      </li>
   </ul>

   <p>Every time the Log::ProgramInfo module is used, the import list is processed and any values in it are used to update the option 
   values. (The first time it is used, this processing happens after the initialization steps described above.)</p>

   <p>That permits a common group of option settings be processed first, and then specific exceptions to that list over-ridden.</p>

   <p>Any option settings provided in environent variables will over-ride the corresponding setting (whether a default or specified 
   by the program import lists). This allows changing the option settings for individual runs so that the log can be suppressed, enabled, 
   or redirected for a single run of the program.</p>

   <p>The code that prints the log information ensures that it only executes once (in case multiple signals, or a signal during program 
   termination, would cause it to be called additional times).</p>

   <p>If the main body of the program changes a signal handler after Log::ProgramInfo has set it up, that will usually not interfere 
   with Log::ProgramInfo. Usually, the program will catch signals and handle them in a way that allows it continue to operate, or to 
   terminate with an exception. It is only if the program resets a signal handler to its default (abort without normal termination processing) 
   that Log::ProgramInfo's log will not be written. That is not a problem for publication - if the program is being killed by some signal 
   then it is not yet running successfully, and thus not yet ready for publication. However, it does mean that the log might not be 
   available as a diagnostic aid in such situations.</p>

   <p>For most cases, that is the only interaction between the program and Log::ProgramInfo.</p>

   <p>The one additional interaction that might occur is if there is information unique to the program that is desired to be logged. 
   The function</p>

   <p>Log::ProgramInfo::add_extra_logger can be called by the program to specify a callable function that will write additional information 
   to the log. (See the program documentation for precise details.)
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#">Go to:</a> <b>Results and discussion</b></p>

   <p>Parameters are available to control the logging process: whether (and if so, where) a log is to be written. Choosing the location 
   where the log is written allows collecting and managing this important information in a way that co-ordinates with the entire set 
   of computational activity carried out for a research project (or an entire organisation's collection of research projects). The default 
   name used for the log file includes the name of the program that is being reported upon as well as a time-stamp to distinguish separate 
   runs -- you might choose to override the name or directory path to provide more complete organisation of logged results. Suppressing 
   log output can be useful for runs that are not intended to generate reproducible results, such as while the software is being developed. 
   However, even in such cases, it might turn out to be useful to have this log output to assist diagnosing problems with system configuration 
   changes -- to confirm that the environment being used is the one that was intended and that updates have actually occurred, etc.</p>

   <p>There is an additional parameter that permits the logged information to be sent to a separate logging mechanism, such as a Log4Perl 
   log. This would allow the information to be collected with the other logged information from the program. The output to such logs 
   is mixed with the other logged output from the program, and is also usually reformatted to some extent. Such logs cannot be processed 
   by the Log::ProgramInfo parser provided with the package; hence the normal action for Log::ProgramInfo is to still write its own 
   log file as well. <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#">Go to:</a> <b>Log output</b></p>

   <p>The output created by Log::ProgramInfo contains the following information:</p>
   <ul>

      <li>

      <p>MODULE – Name, version, file location, and checksum for each perl library module used by the program.</p>
      </li>

      <li>

      <p>INC – The search path used to find modules.</p>
      </li>

      <li>

      <p>UNAME – Operating system information.</p>
      </li>

      <li>

      <p>PROCn – Specific information for each processor (memory, cores, etc.)</p>
      </li>

      <li>

      <p>PERL – The perl interpretor pathname.</p>
      </li>

      <li>

      <p>PERLVer – The perl interpretor version.</p>
      </li>

      <li>

      <p>PERLSum – Checksum of the perl interpretor binary.</p>
      </li>

      <li>

      <p>libc – The version of libc used by the perl interpretor.</p>
      </li>

      <li>

      <p>libcSUM – Checksum of the libc library used by the perl interpretor.</p>
      </li>

      <li>

      <p>User – The user ID (and real user ID, if different) running the program.</p>
      </li>

      <li>

      <p>Group – The group IDs (and real group IDs, if different) running the program.</p>
      </li>

      <li>

      <p>ProgDir – The directory containing the program.</p>
      </li>

      <li>

      <p>Program – The program name.</p>
      </li>

      <li>

      <p>Version – The program's version.</p>
      </li>

      <li>

      <p>ProgSUM – Checksum of the program file.</p>
      </li>

      <li>

      <p>Args – The number and values of the command line arguments provided to the program.</p>
      </li>

      <li>

      <p>Start – The time the program started running.</p>
      </li>

      <li>

      <p>End – The time the program stopped running.</p>
      </li>

      <li>

      <p>Elapsed – The elapsed time while the program was running.</p>
      </li>

      <li>

      <p>EndStat – The program's exit status.</p>
      </li>

      <li>

      <p>program-specified – Any additional info provided by program-specified callback functions.</p>
      </li>
   </ul>

   <p>The format of the log file is designed to be easily parsed. A parsing subroutine is provided in the package. You could call that 
   subroutine from a program that analyses logs according to your needs. See the program documentation for details. If you have written 
   the log info using a logging module such as Log4Perl, you will have to separately extract the bare ProgramInfo log information out 
   of that log, separating it from any other logging by the program, and removing any line decorations added by the log module.
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#">Go to:</a> <b>Example</b></p>

   <p>Here is an example of using Log::ProgramInfo. Assume a simple program, called simple.pl.</p>
   <img title="An external file that holds a picture, illustration, etc. Object name is 13029_2016_55_Figa_HTML.gif" alt="An external file that holds a picture, illustration, etc. Object name is 13029_2016_55_Figa_HTML.gif" src="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/bin/13029_2016_55_Figa_HTML.gif">
   <a target="object">Open in a separate window</a>

   <p>When you run it, you get two lines of output.</p>
   <img title="An external file that holds a picture, illustration, etc. Object name is 13029_2016_55_Figb_HTML.gif" alt="An external file that holds a picture, illustration, etc. Object name is 13029_2016_55_Figb_HTML.gif" src="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/bin/13029_2016_55_Figb_HTML.gif">
   <a target="object">Open in a separate window</a>

   <p>The first line is the expected output from the program, the second line comes from Log::ProgramInfo to tell you that a log file 
   was created, and where.</p>

   <p>Now, take a look at the log file:</p>
   <ul>

      <li>

      <p>lines beginning with a plus sign are wrapped to fit the page width</p>
      </li>

      <li>

      <p>lines wrapped in angle brackets describe text that has been omitted for brevity</p>
      </li>
   </ul>
   <img title="An external file that holds a picture, illustration, etc. Object name is 13029_2016_55_Figc_HTML.gif" alt="An external file that holds a picture, illustration, etc. Object name is 13029_2016_55_Figc_HTML.gif" src="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/bin/13029_2016_55_Figc_HTML.gif">
   <a target="object">Open in a separate window</a>

   <p>Now that you have a log file, you still have to make use of it. Typically, you would treat this log file as one of the output 
   files of your processing activities. So, if you normally discard the output files (e.g. for a test run while developing the pipeline), 
   you will likely also discard the log. On the other hand, for significant runs, you would collect the log file along with the other 
   output files, labelling and storing them as appropriate for reference. The log file would be available as a synopsis of how the output 
   data was created, ready to be used for publication, or reproducing the process (either to validate the results, or to apply the same 
   process to additional data for subsequent research).
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#">Go to:</a> <b>Limitations</b></p>

   <p>The C environment is not well built for program introspection activities such as determining which static and/or dynamic libraries 
   have been linked into the program's executable image. This module lists the version of libc that was build into the perl binary - 
   but that information can be out of date. A future release may try to get info about other libraries beyond libc.</p>

   <p>Another major problem is that even if a perl module is downloaded from CPAN (which would be one way of ensuring that other people 
   could get the same version), the install process that puts it into the library path for perl programs can be done in may ways, and 
   often is not even done on the same computer as the one that is running the perl program. So, it is not easy to do any sort of detailed 
   validation - the downloaded package bundle is not accessible in any determinable way (and possibly not at all) to the program itself 
   (and thus to Log::ProgramInfo). While it would be possible to compute checksums for every library module that has been loaded, that 
   would take a significant amount of time and is not currently being done. It may be added as an option that could request it explicitly.
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#">Go to:</a> <b>Conclusion</b></p>

   <p>Module Log::ProgramInfo provides a convenient way of logging information about the way a program is run. Adding it to existing 
   programs is as easy as adding one line to the program or any module the program already includes.</p>

   <p>Log::ProgramInfo's output file can be easily included in the published results along with the actual source code (or references 
   to where it can be found). With this log output, other researchers have information necessary to any meaningful attempt to reproduce 
   the original research, either in the process of validating or extending that research.</p>

   <p>Log::ProgramInfo is a good candidate for inclusion in modules intended to mandate standards, and may find use well beyond the 
   field of bioinformatics. <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#">Go to:</a> <b>Availability 
   and requirements</b></p>
   <ul>

      <li>

      <p>Project name: LogProgramInfo</p>
      </li>

      <li>

      <p>Project Home Page: <a target="_blank" href="http://search.cpan.org/search?query=Log%3A%3AProgramInfo&mode=all">http://search.cpan.org/search?query=Log%3A%3AProgramInfo&mode=all</a></p>
      </li>

      <li>

      <p>Operating System(s): Linux, Unix, Mac OS X (untested), Windows (untested)</p>
      </li>

      <li>

      <p>Programming Language: Perl 5</p>
      </li>

      <li>

      <p>Other Requirements: none</p>
      </li>

      <li>

      <p>License: Perl 5 License (Artistic 1 & GPL 1)</p>
      </li>
   </ul>

   <p><a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#">Go to:</a> <b>Acknowledgements</b></p>

   <p>Special thanks to Julie Livingstone and Renasha Small-O'Connor for editorial assistance.
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#">Go to:</a> <b>Footnotes</b></p>

   <p>cc Bug Reports To: BoutrosLabSoftware@oicr.on.ca</p>

   <p>Funding</p>

   <p>This study was conducted with the support of the Ontario Institute for Cancer Research to PCB through funding provided by the 
   Government of Ontario. This work was supported by Prostate Cancer Canada and is proudly funded by the Movember Foundation – Grant 
   #RS2014-01. Dr. Boutros was supported by a Terry Fox Research Institute New Investigator Award and a CIHR New Investigator Award. 
   This project was supported by Genome Canada through a Large-Scale Applied Project contract to PCB, Dr. Sohrab Shah and Dr. Ryan Morin.</p>

   <p>Authors' contributions</p>

   <p>The module was written by the authors. Both authors read and approved the final manuscript.</p>

   <p>Competing interests</p>

   <p>The authors declare that they have no competing interests.</p>

   <p><a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#">Go to:</a> <b>Contributor Information</b></p>

   <p>John M. Macdonald, Email: <a data-email="ac.no.rcio@dlanodcam.nhoj" href="mailto:dev@null">ac.no.rcio@dlanodcam.nhoj</a> .</p>

   <p>Paul C. Boutros, Email: <a data-email="ac.no.rcio@sortuob.luap" href="mailto:dev@null">ac.no.rcio@sortuob.luap</a> .
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#">Go to:</a> <b>References</b> 1. Macdonald J, Boutros 
   P. Log-ProgramInfo. module available from CPAN. <a target="_blank" href="http://search.cpan.org/~boutroslb/Log-ProgramInfo/">http://search.cpan.org/~boutroslb/Log-ProgramInfo/</a> 
   . 2. Nature-editorial. Code share. Nature. 2014;514. doi:10.1038/514536a. 3. Ewing A, Houlahan K, Hu Y, Ellrott K, Caloian C, Yamaguchi 
   T, Bare J, P'ng C, Waggott D, Sabelnykova V, ICGC-TCGA DREAM Somatic Mutation Calling Challenge participants. Kellen M, Norman T, 
   Haussler D, Friend S, Stolovitzky G, Margolin A, Stuart J, Boutros P. Combining accurate tumour genome simulation with crowd-sourcing 
   to benchmark somatic single nucleotide variant detection. Nat Methods. 2015; 514 :623–30. doi: 10.1038/nmeth.3407. [
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4856034/">PMC free article</a> ] [
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pubmed/25984700">PubMed</a> ] [
   <a target="_blank" href="https://dx.doi.org/10.1038/nmeth.3407">CrossRef</a> ] [
   <a target="_blank" href="https://scholar.google.com/scholar_lookup?journal=Nat+Methods&title=Combining+accurate+tumour+genome+simulation+with+crowd-sourcing+to+benchmark+somatic+single+nucleotide+variant+detection&author=A+Ewing&author=K+Houlahan&author=Y+Hu&author=K+Ellrott&author=C+Caloian&volume=514&publication_year=2015&pages=623-30&pmid=25984700&doi=10.1038/nmeth.3407&">
   Google Scholar</a> ] 4. sourceforge-BWA-files. Sourceforge File Listing for BWA on 30 Apr 2015. hand counted from web page.
   <a target="_blank" href="http://sourceforge.net/projects/bio-bwa/files/">http://sourceforge.net/projects/bio-bwa/files/</a> . 5. 
   Wilson G, Aruliah DA, Brown CT, Hong NPC, Davis M, Guy RT, Haddock SHD, Huff KD, Mitchell IM, Plumbley MD, Waugh B, White EP, Wilson 
   P. Best practices for scientific computing. PLoS Biol. 2014;12(1). doi:10.1371/journal.pbio.1001745. [
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3886731/">PMC free article</a> ] [
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pubmed/24415924">PubMed</a> ] 6. Stajich J, Block D, Boulez K, Brenner SE, 
   Dagdigian C, Fuellen G, Gilbert JGR, Korf I, Lapp H, Lehväslaiho H, Matsalla C, Mungall CJ, Osborne BI, Popock MR, Schattner P, Senger 
   M, Stein L, Stupka E, Wilkinson MD, Birney E. The bioperl toolkit: Perl modules for the life sciences. Genome Res. 2002; 12 (10):1611–8. 
   doi: 10.1101/gr.361602. [ <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC187536/">PMC free article</a> ] [
   <a target="_blank" href="https://www.ncbi.nlm.nih.gov/pubmed/12368254">PubMed</a> ] [
   <a target="_blank" href="https://dx.doi.org/10.1101/gr.361602">CrossRef</a> ] [
   <a target="_blank" href="https://scholar.google.com/scholar_lookup?journal=Genome+Res&title=The+bioperl+toolkit:+Perl+modules+for+the+life+sciences&author=J+Stajich&author=D+Block&author=K+Boulez&author=SE+Brenner&author=C+Dagdigian&volume=12&issue=10&publication_year=2002&pages=1611-8&pmid=12368254&doi=10.1101/gr.361602&">
   Google Scholar</a> ] 7. Chirigati F, Shasha D, Freire J. Presented as Part of the 5th USENIX Workshop on the Theory and Practice 
   of Provenance. Berkeley: USENIX; 2013. Reprozip: Using provenance to support computational reproducibility. [
   <a target="_blank" href="https://scholar.google.com/scholar_lookup?title=Presented+as+Part+of+the+5th+USENIX+Workshop+on+the+Theory+and+Practice+of+Provenance&author=F+Chirigati&author=D+Shasha&author=J+Freire&publication_year=2013&">
   Google Scholar</a> ]</p>
   <ul>

      <li><a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#Abs1title">Abstract</a></li>

      <li><a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#Sec1title">Background</a></li>

      <li><a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#Sec2title">Related work</a></li>

      <li><a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#Sec3title">Implementation</a></li>

      <li><a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#Sec4title">Results and discussion</a></li>

      <li><a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#Sec5title">Log output</a></li>

      <li><a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#Sec6title">Example</a></li>

      <li><a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#Sec7title">Limitations</a></li>

      <li><a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#Sec8title">Conclusion</a></li>

      <li><a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#Sec9title">Availability and requirements</a></li>

      <li><a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#idm140320286431168title">Acknowledgements</a></li>

      <li><a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#idm140320250551424title">Footnotes</a></li>

      <li><a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#idm140320254303904aff-infotitle">Contributor 
      Information</a></li>

      <li><a target="_blank" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4919834/#Bib1title">References</a></li>
   </ul>
   <hr>Articles from Source Code for Biology and Medicine are provided here courtesy of BioMed Central<p> </p><!--TAGS: .  -->

<!--file:///f:/Public_html/Scripting/Perlorama/Logging/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190828X_logprograminfo_a_perl_module_to_collect_and_log_data_for_bioinformatics_pipelines"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190828X_echo_command_in_linux_with_examples" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190827X_how_do_i_get_the_filename_and_line_number_in_perl_stack_overflow"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Aug 28, 2019] <a target="_blank" href="https://linoxide.com/linux-command/echo-command-in-linux/">Echo Command in Linux with   Examples</a></h4>

<h5>Notable quotes:</h5>
<h5>"...  The -e parameter is used for the interpretation of backslashes ..."</h5>
<h5>"...  The -n option is used for omitting trailing newline. ..."</h5>
<blockquote>
<h6>Aug 28, 2019 |  <a target="_blank" href= "https://linoxide.com/linux-command/echo-command-in-linux/">linoxide.com</a></h6>
 

    <p><em>The -e parameter is used for the interpretation of backslashes</em></p>

    <p>... ... ...</p>To create a new line after each word in a string use the -e operator with the
    \n option as shown
    <pre>
$ echo -e "Linux \nis \nan \nopensource \noperating \nsystem"
</pre>

    <p>... ... ...</p><b>Omit echoing trailing newline</b>

    <p><em>The -n option is used for omitting trailing newline.</em> This is shown in the example below</p>
    <pre>
$ echo -n "Linux is an opensource operating system"
</pre>

    <p>Sample Output</p>
    <pre>
Linux is an opensource operating systemjames@buster:/$
</pre>


 <!--TAGS: . ~/Bash2/Tips2 ~/File_operations2 ~/Bash_language2-->
 <!--file:///f:/Public_html/Admin/tips.shtml-->
<!--file:///f:/Public_html/Admin/index.shtml-->
<!--file:///f:/Public_html/Scripting/Shellorama/bash_tips_and_tricks.shtml-->
<!--file:///f:/Public_html/Scripting/Shellorama/bash.shtml-->
<!--file:///f:/Public_html/Scripting/shells.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/File_operations/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/Shellorama/bash_as_scripting_language.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190828X_echo_command_in_linux_with_examples"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190827X_how_do_i_get_the_filename_and_line_number_in_perl_stack_overflow" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190826X_static_and_state_variables_in_perl"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Aug 27, 2019] <a target="_blank" href="https://stackoverflow.com/questions/4071447/how-do-i-get-the-filename-and-line-number-in-perl">How   do I get the filename and line number in Perl - Stack Overflow</a></h4>

<blockquote>
<h6>Aug 27, 2019 |  <a target="_blank" href= "https://stackoverflow.com/questions/4071447/how-do-i-get-the-filename-and-line-number-in-perl"> stackoverflow.com</a></h6>
 

    <p><b><a target="_blank" href=
    "https://stackoverflow.com/questions/4071447/how-do-i-get-the-filename-and-line-number-in-perl">
    How do I get the filename and line number in Perl?</a></b> <a target="_blank" href=
    "https://stackoverflow.com/questions/ask">Ask Question</a> Asked 8 years, 10 months ago Active
    <a target="_blank" href=
    "https://stackoverflow.com/questions/4071447/how-do-i-get-the-filename-and-line-number-in-perl?lastactivity">
    8 years, 9 months ago</a> Viewed 6k times 6</p>
    <hr noshade align="left" width="10" size="10">

    <p><b><a target="_blank" href="https://stackoverflow.com/users/33611/elijah">Elijah</a></b>
    ,Nov 1, 2010 at 17:35</p>

    <blockquote>
      I would like to get the current filename and line number within a Perl script. How do I do
      this?

      <p>For example, in a file call <code>test.pl</code> :</p>
      <pre>
my $foo = 'bar';
print 'Hello World';
print functionForFilename() . ':' . functionForLineNo();
</pre>

      <p>It would output:</p>
      <pre>
Hello World
test.pl:3
</pre>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/471272/tchrist">tchrist</a></b>
    ,Nov 2, 2010 at 19:13</p>

    <blockquote>
      These are available with the <code>__LINE__</code> and <code>__FILE__</code> tokens, as
      documented in <a target="_blank" href=
      "http://perldoc.perl.org/perldata.html#Special-Literals">perldoc perldata</a> under "Special
      Literals":

      <blockquote>
        <p>The special literals __FILE__, __LINE__, and __PACKAGE__ represent the current filename,
        line number, and package name at that point in your program. They may be used only as
        separate tokens; they will not be interpolated into strings. If there is no current package
        (due to an empty package; directive), __PACKAGE__ is the undefined value.</p>
      </blockquote>
    </blockquote>

    <p><b><a target="_blank" href="https://stackoverflow.com/users/189416/eric-strom">Eric
    Strom</a></b> ,Nov 1, 2010 at 17:41</p>

    <blockquote>
      The <code>caller</code> function will do what you are looking for:
      <pre>
sub print_info {
   my ($package, $filename, $line) = caller;
   ...
}

print_info(); # prints info about this line
</pre>

      <p>This will get the information from where the sub is called, which is probably what you are
      looking for. The <code>__FILE__</code> and <code>__LINE__</code> directives only apply to
      where they are written, so you can not encapsulate their effect in a subroutine. (unless you
      wanted a sub that only prints info about where it is defined)</p>
    </blockquote>

    <p>,</p>

    <blockquote>
      You can use:
      <pre>
print __FILE__. " " . __LINE__;
</pre>
    </blockquote>
 <!--TAGS: . ~/Scripting -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_debugging.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190827X_how_do_i_get_the_filename_and_line_number_in_perl_stack_overflow"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190826X_static_and_state_variables_in_perl" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190826X_beginning_perl_programming_from_novice_to_professional"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Aug 26, 2019] <a target="_blank" href="https://perlmaven.com/static-and-state-variables-in-perl">Static and state variables in   Perl</a></h4>

<blockquote>
<h6>Aug 26, 2019 |  <a target="_blank" href= "https://perlmaven.com/static-and-state-variables-in-perl">perlmaven.com</a></h6>
 
 

    <p>In most of the cases we either want a variable to be accessible only from inside a small
    scope, inside a function or even inside a loop. These variables get created when we enter the
    function (or the scope created by a a block) and destroyed when we leave the scope.</p>

    <p>In some cases, especially when we don't want to pay attention to our code, we want variables
    to be global, to be accessible from anywhere in our script and be destroyed only when the
    script ends. In General having such global variables is not a good practice.</p>

    <p>In some cases we want a variable to stay alive between function calls, but still to be
    private to that function. We want it to retain its value between calls.</p>

    <p>Are you serious about Perl? Check out my <a target="_blank" href=
    "https://leanpub.com/perl-maven">Beginner Perl Maven book</a> .<br>
    I have written it for you!</p>

    <p>In the C programming language one can designate a variable to be a <a target="_blank" href=
    "http://en.wikipedia.org/wiki/Static_variable">static variable</a> . This means it gets
    initialized only once and it sticks around retaining its old value between function calls.</p>

    <p>In Perl, the same can be achieved using the <a target="_blank" href=
    "https://perlmaven.com/what-is-new-in-perl-5.10--say-defined-or-state">state variable</a> which
    is available starting from version 5.10, but there is a construct that will work in every
    version of Perl 5. In a way it is even more powerful.</p>

    <p>Let's create a counter as an example:</p><b>state variable</b>

    <ol>
      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use 5.010 ;</li>

      <li>sub count {</li>

      <li>state $counter = 0 ;</li>

      <li>$counter ++;</li>

      <li>return $counter ;</li>

      <li>}</li>

      <li>say count ();</li>

      <li>say count ();</li>

      <li>say count ();</li>

      <li>#say $counter;</li>
    </ol>

    <p>In this example, instead of using <a target="_blank" href=
    "https://perlmaven.com/variable-declaration-in-perl">my to declare the internal variable</a> ,
    we used the state keyword.</p><a target="_blank" href=
    "https://leanpub.com/perl-maven/"><img src=
    "https://perlmaven.com/img/perl-maven-book-cover-306x396.png"></a> $counter is initialized to 0
    only once, the first time we call counter() . In subsequent calls, the line state $counter = 0;
    does not get executed and $counter has the same value as it had when we left the function the
    last time.

    <p>Thus the output will be:</p>
    <pre>
1
2
3
</pre>

    <p>If we removed the # from last line, it would generate a <a target="_blank" href=
    "https://perlmaven.com/global-symbol-requires-explicit-package-name">Global symbol "$counter"
    requires explicit package name at ... line ...</a> error when trying to compile the script.
    This just shows that the variable $counter is not accessible outside the function.</p><b>state
    is executed in the first call</b>

    <p>Check out this strange example:</p>

    <ol>
      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use 5.010 ;</li>

      <li>sub count {</li>

      <li>state $counter = say "world" ;</li>

      <li>$counter ++;</li>

      <li>return $counter ;</li>

      <li>}</li>

      <li>say "hello" ;</li>

      <li>say count ();</li>

      <li>say count ();</li>

      <li>say count ();</li>
    </ol>

    <p>This will print out</p>
    <pre>
hello
world
2
3
4
</pre>

    <p>showing that the state $counter = say "world"; line only gets executed once. In the first
    call to count() say , which was also <a target="_blank" href=
    "https://perlmaven.com/what-is-new-in-perl-5.10--say-defined-or-state">added in version
    5.10</a> , will return 1 upon success.</p><b>static variables in the "traditional" way</b>

    <ol>
      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use 5.010 ;</li>

      <li>{</li>

      <li>my $counter = 0 ;</li>

      <li>sub count {</li>

      <li>$counter ++;</li>

      <li>return $counter ;</li>

      <li>}</li>

      <li>}</li>

      <li>say count ();</li>

      <li>say count ();</li>

      <li>say count ();</li>
    </ol>

    <p>This provides the same result as the above version using state , except that this could work
    in older versions of perl as well. (Especially if I did not want to use the say keyword, that
    was also introduced in 5.10.)</p>

    <p>This version works because functions declarations are global in perl - so count() is
    accessible in the main body of the script even though it was declared inside a block. On the
    other hand the variable $counter is not accessible from the outside world because it was
    declared inside the block. Lastly, but probably most importantly, it does not get destroyed
    when we leave the count() function (or when the execution is outside the block), because the
    existing count() function still references it.</p>

    <p>Thus $count is effectively a static variable.</p><b>First assignment time</b>

    <ol>
      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use 5.010 ;</li>

      <li>say "hi" ;</li>

      <li>{</li>

      <li>my $counter = say "world" ;</li>

      <li>sub count {</li>

      <li>$counter ++;</li>

      <li>return $counter ;</li>

      <li>}</li>

      <li>}</li>

      <li>say "hello" ;</li>

      <li>say count ();</li>

      <li>say count ();</li>

      <li>say count ();</li>
    </ol>
    <pre>
hi
world
hello
2
3
4
</pre>

    <p>This shows that in this case too, the declaration and the initial assignment my $counter =
    say "world"; happens only once, but we can also see that the assignment happens <b>before</b>
    the first call to count() as if the my $counter = say "world"; statement was part of the
    control flow of the code <b>outside</b> of the block.</p><b>Shared static variable</b>

    <p>This "traditional" or "home made" static variable has an extra feature. Because it does not
    belong to the the count() subroutine, but to the block surrounding it, we can declare more than
    one functions in that block and we can share this static variable between two or even more
    functions.</p>

    <p>For example we could add a reset_counter() function:</p>

    <ol>
      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use 5.010 ;</li>

      <li>{</li>

      <li>my $counter = 0 ;</li>

      <li>sub count {</li>

      <li>$counter ++;</li>

      <li>return $counter ;</li>

      <li>}</li>

      <li>sub reset_counter {</li>

      <li>$counter = 0 ;</li>

      <li>}</li>

      <li>}</li>

      <li>say count ();</li>

      <li>say count ();</li>

      <li>say count ();</li>

      <li>reset_counter ();</li>

      <li>say count ();</li>

      <li>say count ();</li>
    </ol>
    <pre>
1
2
3
1
2
</pre>

    <p>Now both functions can access the $counter variable, but still nothing outside the enclosing
    block can access it.</p><b>Static arrays and hashes</b>

    <p>As of now, you cannot use the state declaration in list context. This means you cannot write
    state @y = (1, 1); . This limitation could be overcome by some extra coding. For example in
    this implementation of the Fibonacci series, we checked if the array is empty and set the
    default values:</p>

    <ol>
      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use 5.010 ;</li>

      <li>sub fib {</li>

      <li>state @y ;</li>

      <li>@y = ( 1 , 1 ) if not @y ; # workaround initialization</li>

      <li>push @y , $y [ 0 ]+ $y [ 1 ];</li>

      <li>return shift @y ;</li>

      <li>}</li>

      <li>say fib ();</li>

      <li>say fib ();</li>

      <li>say fib ();</li>

      <li>say fib ();</li>

      <li>say fib ();</li>
    </ol>

    <p>Alternatively we could use the "old-style" static variable with the enclosing block.</p>

    <p>Here is the example generating the Fibonacci series:</p>

    <ol>
      <li>use strict ;</li>

      <li>use warnings ;</li>

      <li>use 5.010 ;</li>

      <li>{</li>

      <li>my @y = ( 1 , 1 );</li>

      <li>sub fib {</li>

      <li>push @y , $y [ 0 ]+ $y [ 1 ];</li>

      <li>return shift @y ;</li>

      <li>}</li>

      <li>}</li>

      <li>say fib ();</li>

      <li>say fib ();</li>

      <li>say fib ();</li>

      <li>say fib ();</li>
    </ol>
    
 <!--TAGS: . /state_variables. -->

<!--file:///f:/Public_html/Scripting/Perlorama/Variables/state_variables.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/Variables/index.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190826X_static_and_state_variables_in_perl"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190826X_beginning_perl_programming_from_novice_to_professional" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190826X_debugging_how_can_i_debug_a_perl_script_stack_overflow"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Aug 26, 2019] <a target="_blank" href="https://www.amazon.com/Beginning-Perl-Programming-Novice-Professional/dp/1484250540/ref=sr_1_1?keywords=Beginning+Perl+Programming+From+Novice+to+Professional&qid=1566869069&s=gateway&sr=8-1">   Beginning Perl Programming From Novice to Professional</a></h4>

<blockquote>
<h6>Aug 26, 2019 |  <a target="_blank" href= "https://www.amazon.com/Beginning-Perl-Programming-Novice-Professional/dp/1484250540/ref=sr_1_1?keywords=Beginning+Perl+Programming+From+Novice+to+Professional&qid=1566869069&s=gateway&sr=8-1"> www.amazon.com</a></h6>
 

    <p><b>Debugger Commands</b> The debugger has many built-in commands. The most common are as
    follows.</p>

    <table border="1">
      <colgroup>
        <col>
        <col>
      </colgroup>

      <thead>
        <tr>
          <th bgcolor="#C0C0C0">
            <p>Command</p>
          </th>

          <th bgcolor="#C0C0C0">
            <p>Meaning</p>
          </th>
        </tr>
      </thead>

      <tr>
        <tt>
        <td>
          <p><font color="#0000FF"><b>!! cmd</b></font></p>
        </td>

        <td>
          <p>Runs the command (cmd) in a separate process (this is typically a shell command)</p>
        </td>
      </tr>

      <tr>
        <td>
          <p><font color="#0000FF"><b>h</b></font></p>
        </td>

        <td>
          <p>Interactive help</p>
        </td>
      </tr>

      <tr>
        <td>
          <p><font color="#0000FF"><b>H -num</b></font></p>
        </td>

        <td>
          <p>Prints last "num" commands (excludes single character commands)</p>
        </td>
      </tr>

      <tr>
        <td>
          <p><font color="#0000FF"><b>l</b></font></p>
        </td>

        <td>
          <p>Lists the next line of code to be executed</p>
        </td>
      </tr>

      <tr>
        <td>
          <p><font color="#0000FF"><b>n</b></font></p>
        </td>

        <td>
          <p>Steps through a statement (if subroutines are called, executes over the
          subroutine)</p>
        </td>
      </tr>

      <tr>
        <td>
          <p><font color="#0000FF"><b>q</b></font></p>
        </td>

        <td>
          <p>Quits the debugger</p>
        </td>
      </tr>

      <tr>
        <td>
          <p><font color="#0000FF"><b>s</b></font></p>
        </td>

        <td>
          <p>Steps through a statement (if subroutines are called, executes one subroutine
          statement at a time)</p>
        </td>
      </tr>

      <tr>
        <td>
          <p><font color="#0000FF"><b>V</b></font></p>
        </td>

        </tt>

        <td>
          <p>Displays all of the variables in package (defaults to main)</p>
        </td>
      </tr>
    </table>
 <!--TAGS: . ~/Bookshelf -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_debugging.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Bookshelf/index.shtml-->
<!--file:///f:/Public_html/Education/index.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190826X_beginning_perl_programming_from_novice_to_professional"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190826X_debugging_how_can_i_debug_a_perl_script_stack_overflow" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190826X_d_ebugging_how_to_use_the_perl_debugger"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Aug 26, 2019] <a target="_blank" href="https://stackoverflow.com/questions/4945876/how-can-i-debug-a-perl-script">debugging - How can I   debug a Perl script - Stack Overflow</a></h4>

<blockquote>
<h6>Jun 27, 2014 |  <a target="_blank" href= "https://stackoverflow.com/questions/4945876/how-can-i-debug-a-perl-script">stackoverflow.com</a></h6>
 

    <p><b><a target="_blank" href="https://stackoverflow.com/users/74585/matthew-lock">Matthew
    Lock</a></b> ,Jun 27, 2014 at 1:01</p>

    <blockquote>
      To run your script under perl debugger you should use <code>-d</code> switch:
      <pre>
perl -d script.pl
</pre>

      <p>But perl is flexible. It supply some hooks and you may force debugger to work as you
      want</p>

      <p>So to use different debuggers you may do:</p>
      <pre>
perl -d:DebugHooks::Terminal script.pl
# OR
perl -d:Trepan script.pl
</pre>

      <p>Look these modules <a target="_blank" href=
      "https://metacpan.org/pod/Devel::DebugHooks">here</a> and <a target="_blank" href=
      "https://metacpan.org/pod/Devel::Trepan">here</a></p>

      <p>There are several most interesting perl modules that hook into perl debugger internals:
      <a target="_blank" href="https://metacpan.org/pod/Devel::NYTProf">Devel::NYTProf</a> ,
      <a target="_blank" href="https://metacpan.org/pod/Devel::Cover">Devel::Cover</a></p>

      <p>And <a target="_blank" href=
      "https://metacpan.org/search?q=Devel%3A%3A&search_type=modules">many others</a></p>
    </blockquote>

    <p><b>XXX</b>,</p>

    <blockquote>
      If you want to do remote debug (for cgi or if you don't want to mess output with debug
      command line) use this:

      <p>given test:</p>
      <pre>
use v5.14;
say 1;
say 2;
say 3;
</pre>

      <p>Start a listener on whatever host and port on terminal 1 (here localhost:12345):</p>
      <pre>
$ nc -v -l localhost -p 12345</pre>

      <p>for readline support use <a target="_blank" href=
      "http://utopia.knoware.nl/~hlub/uck/rlwrap/#rlwrap">rlwrap</a> (you can use on <code>perl
      -d</code> too):</p>
      <pre>
$ rlwrap nc -v -l localhost -p 12345</pre>

      <p>And start the test on another terminal (say terminal 2):</p>
      <pre>
$ PERLDB_OPTS="RemotePort=localhost:12345" perl -d test
</pre>

      <p>Input/Output on terminal 1:</p>
      <pre>
Connection from 127.0.0.1:42994

Loading DB routines from perl5db.pl version 1.49
Editor support available.

Enter h or 'h h' for help, or 'man perldebug' for more help.

main::(test:2): say 1;
  DB<1> n
main::(test:3): say 2;
  DB<1> select $DB::OUT

  DB<2> n
2
main::(test:4): say 3;
  DB<2> n
3
Debugged program terminated.  Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.  
  DB<2>
</pre>

      <p>Output on terminal 2:</p>
      <pre>
1
</pre>

      <p>Note the sentence if you want output on debug terminal</p>
      <pre>
select $DB::OUT
</pre>

      <p>If you are vim user, install this plugin: <a target="_blank" href=
      "https://github.com/albfan/dbg.vim">dbg.vim</a> which provides basic support for perl</p>
    </blockquote>
 <!--TAGS: . ~/Scripting -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_debugging.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190826X_debugging_how_can_i_debug_a_perl_script_stack_overflow"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190826X_d_ebugging_how_to_use_the_perl_debugger" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190803X_was_future_president_george_h_w_bush_at_dealey_plaza_during_jfk_s_assassination_quora"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Aug 26, 2019] <a target="_blank" href="https://stackoverflow.com/questions/23233050/how-to-use-the-perl-debugger">D>ebugging - How to   use the Perl debugger</a></h4>

<blockquote>
<h6>Aug 26, 2019 |  <a target="_blank" href= "https://stackoverflow.com/questions/23233050/how-to-use-the-perl-debugger">stackoverflow.com</a></h6>
 

      This is like <i>"please can you give me an example how to drive a car"</i> .

      <p>I have explained the basic commands that you will use most often. Beyond this you must
      read the debugger's inline help and reread the <a target="_blank" href=
      "http://perldoc.perl.org/perldebug.html">perldebug</a> documentation</p>
    <ul>

       <li>The debugger starts by displaying the <i>next</i> line to be executed: usually the
        first line in your program</li>

       <li>Debugger commands are mostly single letters, possibly with parameters. The command will
        be actioned as soon as you press <kbd>Enter</kbd></li>

       <li>You should concentrate on commands <code>s</code> and <code>n</code> to step through
        the program. If the next statement is a subroutine (or method) call then <code>s</code>
        will step <i>into</i> the subroutine while <code>n</code> will step <i>over</i> the call.
        Otherwise <code>s</code> and <code>n</code> behave identically

          <p>Be careful using <code>s</code> when a single line of code contains multiple
          subroutine calls. You may not be stepping into the subroutine that you expect</p>

       <p>You can't step <i>into</i> a built-in function, or a subroutine not written in
          Perl</p>

       <p>Once you have executed a statement there is no going back. You must restart the
          program to try something different</p></li>

       <li>You can execute a line of Perl code just by typing it in and pressing <kbd>Enter</kbd>
        . the code will be executed in the context of the current statement

          <p>You can examine or <i>modify</i> any variable this way</p></li>

       <li>The <code>p</code> command is <i>identical</i> to <code>print</code> . The output from
        <code>p $var</code> or <code>p @arr</code> will be the same as if you had typed <code>p
        $var</code> or <code>p @arr</code></li>

       <li>You can use <code>x</code> to dump an expression in <i>list</i> context. The output
        consists of numbered lines showing each element of the list</li>

       <li>The commands dot <code>.</code> , hyphen <code>-</code> and <code>v</code> are useful
        for looking at the source code. <code>.</code> and <code>-</code> will display the current
        and previous source line respectively. <code>v</code> will display a window around the
        current source line</li>

       <li>To rapidly return to a specific line of code you can set a <i>breakpoint</i> and
        continue execution until that line using the <code>c</code> command. For example <code>c
        13</code> <kbd>Enter</kbd> will execute all code until line 13 and then stop

          <p>Breakpoints defined using <code>c</code> are <i>temporary</i> , so if you want to
          continue to the same line again (in a loop) then you have to enter <code>c 13</code> <kbd>Enter</kbd> again</p>

       <p><code>c</code> without any parameters will run the rest of the program until it exits
          or until a permanent breakpoint, defined using <code>b</code> , is reached</p></li>

       <li>You can specify breakpoints with more complex conditions using the <code>b</code>
        command. They can be deleted only with the corresponding <code>B</code> command, or <code>B
        *</code> which will clear all breakpoints</li>

       <li><code>h</code> shows a list of the commands available, and <code>h *command*</code> ,
        like <code>h c</code> , will show you detailed help on a single command</li>

       <li>Finally, <code>q</code> will end the debug session and terminate the program</li>
    </ul>

    <p>The debugger will do a lot more than this, but these are the basic commands that you need
      to know. You should experiment with them and look at the contents of the help text to get
      more proficient with the Perl debugger</p>
 <!--TAGS: . ~/Scripting -->
 <!--file:///f:/Public_html/Scripting/Perlorama/perl_debugging.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_language.shtml-->
<!--file:///f:/Public_html/Scripting/Perlorama/perl_tips.shtml-->
<!--file:///f:/Public_html/Scripting/index.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190826X_d_ebugging_how_to_use_the_perl_debugger"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190803X_was_future_president_george_h_w_bush_at_dealey_plaza_during_jfk_s_assassination_quora" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190427X_what_are_the_main_differences_between_religion_and_ideology_quora"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Aug 03, 2019] <a target="_blank" href="https://www.quora.com/Was-future-President-George-H-W-Bush-at-Dealey-Plaza-during-JFKs-assassination">   Was future President George H. W. Bush at Dealey Plaza during JFK's assassination -   Quora</a></h4>

<h5>Notable quotes:</h5>
<h5>"...  There is a photo of someone who looks like him standing in front of the School Book     Depository. Bush is one of the few people in America who can't remember where he was that day.      ..."</h5>
<blockquote>
<h6>Aug 03, 2019 |  <a target="_blank" href= "https://www.quora.com/Was-future-President-George-H-W-Bush-at-Dealey-Plaza-during-JFKs-assassination"> www.quora.com</a></h6>
 

    <hr noshade align="left" width="10" size="10">

    <p><a target="_blank" href="https://www.quora.com/profile/Kevin-Stewart-84">Kevin Stewart</a> ,
    Writer <a target="_blank" href=
    "https://www.quora.com/Was-future-President-George-H-W-Bush-at-Dealey-Plaza-during-JFKs-assassination/answer/Kevin-Stewart-84">
    Answered Nov 4 2018</a> · Author has 370 answers and 39.7k answer views</p>

    <blockquote>

       <p>There is some flimsy photo evidence of someone who looked like him in Dealey Plaza, so my
    answer would be, "not sure." But anecdotally, there sure seems to be a large number of
    "coincidences" around a guy who could apparently walk across a snow covered field without
    leaving foot prints , so maybe.</p>

       <p>Since the beginning, the rumored driving motive for JFK's assassination, (from both sides
    really) was the cluster-fuck known as "The Bay of Pigs invasion," so we'll start there. At the
    end of Mark Lane's book "Plausible Denial," (the account of E. Howard Hunt's ill-fated lawsuit
    against The Liberty Lobby) some interesting facts about the Bay of Pigs invasion were tossed
    out that leaves one scratching his or her head and wondering if 41 had anything to do with it.
    The operation was ostensibly to deliver small arms and ordnance to a (turns out to be
    fictional) 25,000 man rebel army that was in the Cuban hills waiting for help to depose Castro.
    </p>

       <p>The US Navy supplied a couple of ships, but they were decommissioned, had their numbers scraped
    off, and were renamed the "Houston" and the "Barbara," (or the Spanish spelling of Barbara.)
    This is while 41 was living in Houston with his wife Barbara. Also, the CIA code name for the
    invasion was "Operation Zapata." </p>

       <p>This while the name of 41's business was "Zapata Offshore."
    (Or something like that. 41 had business' using Zapata's name since his days as an oilman in
    Midland Texas.) The day after Kennedy's killing, a George Bush met with Army Intel. What went
    on in that meeting is a mystery, and the CIA unconvincingly claims that they had another guy
    working for them named George Bush, only he wasn't hired until 1964 and his expertise was
    meteorology so it's difficult to understand why they wanted to talk with him on that day. Then
    there's the fact that Oswald's CIA handler, a guy name Georges DeMorinshilt (sp?) had the name
    George (Poppy) Bush in his address book along with 41's Houston address and phone number.</p>

       <p>Of course this is all coincidental, but consider: 41 was a failed two-term congressman who
    couldn't hold his seat, (in Houston Texas of all places) and yet was made by Nixon the
    ambassador to the UN, then Ford named him ambassador to China and the Director of the CIA. Wow!
    What a lucky guy.</p>

       <p>So was he involved with the Kennedy assassination and photographed in Dealey Plaza? Don't
    know. I was 13 at the time, but in the intervening years, the politics in this country,
    especially relating to the Republican Party, have become shall we say, "Kalfkaesque." </p>
    </blockquote>

    <p><b><a target="_blank" href="https://www.quora.com/profile/Steven-Hager">Steven Hager</a> </b>, Author
    of "Killing Kennedy." 
    <a target="_blank" href=
    "https://www.quora.com/Was-future-President-George-H-W-Bush-at-Dealey-Plaza-during-JFKs-assassination/answer/Steven-Hager">Updated Dec 31, 2018</a> · Author has 1.2k answers and 1.4m answer views</p>
    <blockquote>

       <p><em>There is a photo of someone who looks like him standing in front of the School Book
    Depository. Bush is one of the few people in America who can't remember where he was that day.
    </em></p>

       <p>There is also a memo by J.Edgar Hoover referencing a "George Bush of the CIA" reporting on
    "misguided Cubans" in Dallas that day. The CIA had a safe house stuffed with Cuban agents in
    the Oak Cliff neighborhood, and Lee Harvey Oswald rented a room nearby shortly before the
    assassination took place.</p>
    </blockquote>

    <p><b><a target="_blank" href="https://www.quora.com/profile/Michael-Tarnpoll">Michael Tarnpoll</a></b> ,
    We came so goddamn close <a target="_blank" href=
    "https://www.quora.com/Was-future-President-George-H-W-Bush-at-Dealey-Plaza-during-JFKs-assassination/answer/Michael-Tarnpoll">
    Answered Feb 2, 2017</a> · Author has 3.7k answers and 1.5m answer views</p>

    <blockquote>

       <p><a target="_blank" href=
    "http://stevenhager.net/2013/11/22/the-george-bush-connections-to-jfks-assassination/">The
    George Bush connections to JFK's assassination</a></p>

       <p> Astoundingly, Bush, the elder, claims that he does not remember where he was when Kennedy
    was assassinated. I do. I'll bet a dollar that you do (if old enough). Everyone above the age
    of fifty-five does except George H. W. Bush. He does however, remember that he was not at
    Dealey Plaza at the time.</p>

       <p>It is interesting to note that photographs and videos exist showing a man who looks very
    much like Bush, at the site, at the time. It was not difficult to find them on line in the
    past. Now, they seem to have been expunged somehow, though a few blurry photos can still be
    found.</p>
    </blockquote>
    
 <!--TAGS: . ~/Perl -->
 <!--file:///f:/Public_html/Skeptics/Political_skeptic/Two_party_system_as_poliarchy/Intelligence_agencies_influence/JFK_assasination/index.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Two_party_system_as_poliarchy/do_the_us_intelligence_agencies_influence_presidential_elections.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Corporatism/National_security_state/Intelligence_services/is_national_security_state_gone_rogue.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Corporatism/National_security_state/Intelligence_services/index.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Corporatism/National_security_state/index.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/index.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Elite_theory/deep_state.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/media_military_industrial_complex.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Neocons/Militarism/index.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Bulletin/political_skeptic2019.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Neocolonialism/War_is_racket/Bulletin/war_is_racket_bulletin2019.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Elite_theory/Deep_state/Bulletin/deep_state_bulletin2019.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190803X_was_future_president_george_h_w_bush_at_dealey_plaza_during_jfk_s_assassination_quora"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190427X_what_are_the_main_differences_between_religion_and_ideology_quora" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190406X_would_you_fly_boeing_737_max_8_ever_again_quora"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Apr 27, 2019] <a target="_blank" href="https://www.quora.com/What-are-the-main-differences-between-religion-and-ideology">What are the main differences between  religion and ideology - Quora </a></h4>

<blockquote>
<h6>Apr 27, 2019 |  <a target="_blank" href="https://www.quora.com/What-are-the-main-differences-between-religion-and-ideology">www.quora.com </a> </h6>
 
<p>
<p>a
rQU
d
JV
lm
b
cJr
y
s
TObs
M
Mr
a
sqQCs
n
J
a
Ryv
g
Fb
e
G
E
aNWBB
n
k
g
wuli
i
Pu
n
LN
e
MI
cLaG
A
GkdE
D
KPJJd
S
ZHmQO
e
ny
l
JACzT
f
gvhU
S
hoqBB
e
QsBBn
r
NqGDf
v
z
i
m
c
aXQ
e
zSU
Fc
P
A
u
Txrqy
s
pVS
<a target="_blank" href="https://www.manageengine.com/products/self-service-password/password-expiration-notifier.html">

                                             Free Active Directory password expiration notification tool.
</a>
<a target="_blank" href="https://www.manageengine.com/products/self-service-password/password-expiration-notifier.html">

                                             Free tool to automatically remind users about password expiration via email, SMS, and 
                                             push notifications.
</a>
<a target="_blank" href="https://www.manageengine.com/products/self-service-password/password-expiration-notifier.html">
                                             L
wjx
e
Lpor
a
zsMV
r
WmU
n
nfoVQ
eftBn
M
UtIUC
o
i
r
oi
e
Zej
Y
a
sk
t
gkK
TOD
m
mT
a
JbQx
n
rIFL
a
De
g
luOwd
e
GKdRL
e
x
n
xIIq
g
uKmA
i
I
n
IPuF
e
QvFM
.
xLEY
c
cMetZ
o
Gtv
m
qNSFZ
</a>

                                       You dismissed this ad.

                                       The feedback you provide will help us show you more relevant content in the future.
<a>Undo
</a>
<b>Answer Wiki
</b>

                                 12 Answers


<a target="_blank" href="https://www.quora.com/profile/Christopher-Story">
<img width="50" height="50" alt="Christopher Story" src="https://qph.fs.quoracdn.net/main-thumb-10177995-50-ttegVFLpvpryeTuQCxw7vrBqMxj5lxeR.jpeg">
</a>
<p>
<a target="_blank" href="https://www.quora.com/profile/Christopher-Story">
                                                                                          Christopher Story
</a>
<g fill="none" fill-rule="evenodd" stroke="#666" stroke-linecap="round" stroke-width="1.5">
</g>


                                                                                                         Lives in Hawai'i
<g fill="none" fill-rule="evenodd" stroke="#666" stroke-width="1.5">
<circle cx="12" cy="12" r="3">
</circle>
</g>


                                                                                                         25.3k answer views
788 
                                                                                                         this month


<a target="_blank" href="https://www.quora.com/profile/Christopher-Story">
<img alt="Christopher Story" src="https://qph.fs.quoracdn.net/main-thumb-10177995-100-ttegVFLpvpryeTuQCxw7vrBqMxj5lxeR.jpeg">
</a>
<a target="_blank" href="https://www.quora.com/profile/Christopher-Story">
                                                                           Christopher Story
</a>
<a target="_blank" href="https://www.quora.com/What-are-the-main-differences-between-religion-and-ideology/answer/Christopher-Story">
                                                                           Answered

Sep 
                                                                           1 2015
</a>
 ·

                                                                           Author has
64
 answers and

25.3k
 answer views

 
One could say that an 
                                                                  ideology is a religion if and only if it is theocratic, but I find 
                                                                  Yuval Harari's understanding of religion less arbitrary and more 
                                                                  compelling.
<p>
                                                                    "Religion is any system of human norms and values that is 
                                                                  founded on a belief in superhuman laws. Religion tells us that we 
                                                                  must obey certain laws that were not invented by humans, and that 
                                                                  humans cannot change at will. Some religions, such as Islam, 
                                                                  Christianity and Hinduism, believe that these super-human laws 
                                                                  were created by the gods. Other religions, such as Buddhism, 
                                                                  Communism and Nazism, believe that these super-human laws are 
                                                                  natural laws. Thus Buddhists believe in the natural laws of karma, 
                                                                  Nazis argued that their ideology reflected the laws of natural 
                                                                  selection, and Communists believe that they follow the natural 
                                                                  laws of economics. No matter whether they believe in divine laws 
                                                                  or in natural laws, all religions have exactly the same function: 
                                                                  to give legitimacy to human norms and values, and to give 
                                                                  stability to human institutions such as states and corporations. 
                                                                  Without some kind of religion, it is simply impossible to maintain 
                                                                  social order. During the modern era religions that believe in 
                                                                  divine laws went into eclipse. But religions that believe in 
                                                                  natural laws became ever more powerful. In the future, they are 
                                                                  likely to become more powerful yet. Silicon Valley, for example, 
                                                                  is today a hot-house of new techno-religions, that promise 
                                                                  humankind paradise here on earth with the help of new technology."</p>


<!--TAGS: . ~/Perl -->

<!--file:///f:/Public_html/Skeptics/Political_skeptic/Neoliberalism/neoliberalism_as_secular_religion.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Neoliberalism/index.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Populism/Christian_populism/pope_francis_on_danger_of_neoliberalism.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Neoliberalism/Bulletin/neoliberalism_bulletin2019.shtml-->
</blockquote>

</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190427X_what_are_the_main_differences_between_religion_and_ideology_quora"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190406X_would_you_fly_boeing_737_max_8_ever_again_quora" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190325X_what_do_you_think_of_jared_kushner_getting_ready_to_unveil_his_economic_plan_for_peace"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Apr 06, 2019] <a target="_blank" href="https://www.quora.com/Would-you-fly-Boeing-737-Max-8-ever-again">Would you fly Boeing 737 Max 8 ever again - Quora </a></h4>

<h5>Notable quotes:</h5>
<h5>"...  No. Possibly                                                                    Boeing & the FAA will solve the immediate issue, but they have                                                                    destroyed Trust.  ..."</h5>
<h5>"...  It has emerged                                                                    on the 737MAX that larger LEAP-1B engines were unsuited to the                                                                    airframe and there is no way now to alter the airframe to balance                                                                    the aircraft.  ..."</h5>
<h5>"...  Boeing failed                                                                    to provide training or training material to pilots or even advise                                                                    them the existence of MCAS. There was a complex two step process                                                                    required of pilots in ET302 and JT610 crashes and their QRH                                                                    handbook did not explain this:  ..."</h5>
<blockquote>
<h6>Apr 06, 2019 |  <a target="_blank" href="https://www.quora.com/Would-you-fly-Boeing-737-Max-8-ever-again">www.quora.com </a> </h6>
 
 
<p>
<b>
Would you fly Boeing 737 Max 8 ever again?
</b>
<a>Update
</a>
<a>Cancel
</a>
<p>
<a target="_blank" href="https://www.quora.com/profile/Simon-Gunson">
                                                                           Simon Gunson
</a>
, 
                                                                           PPL aviation enthusiast
<a target="_blank" href="https://www.quora.com/Would-you-fly-Boeing-737-Max-8-ever-again/answer/Simon-Gunson">
                                                                           Answered Mar 25, 2019
</a>
 ·

Author has
141
 
                                                                           answers and
981.7k
 answer 
                                                                           views


<blockquote>

   <p><em>No. Possibly 
                                                                  Boeing & the FAA will solve the immediate issue, but they have 
                                                                  destroyed Trust.
</em></p>

   <p>Other brands of 
                                                                  aircraft like Airbus with AF447 established trust after their A330 
                                                                  aircraft plunged into the Atlantic in a mysterious accident.
</p>

   <p>With Airbus 
                                                                  everyone saw transparency & integrity in how their accidents were 
                                                                  investigated. How Boeing & FAA approached accident investigation 
                                                                  destroyed public Trust.
</p>

   <p>By direct 
                                                                  contrast in the mysterious disappearance of MH370, Boeing 
                                                                  contributed nothing to the search effort and tried to blame the 
                                                                  pilot or hijackers.
</p>

   <p>With the 737MAX 
                                                                  in Lion Air and Ethiopian crashes Boeing again tried to blame 
                                                                  pilots, poor training, poor maintenance and then when mechanical 
                                                                  defect was proven, Boeing tried to downplay how serious the issue 
                                                                  was and gave false assurances after Lion Air that the plane was 
                                                                  still safe. ET302 proved otherwise.
</p>

   <p>It is no longer 
                                                                  possible to trust the aircraft's certification. It is no longer 
                                                                  possible to trust that safety was the overriding principle in 
                                                                  design of the Boeing 737 MAX nor several other Boeing designs for 
                                                                  that matter.
</p>

   <p>The Public have 
                                                                  yet to realize that the Boeing 777 is an all electric design where 
                                                                  in certain scenarios like electrical fire in the avionics bay, an 
                                                                  MEC override vent opens allowing cabin air pressure to push out 
                                                                  smoke. This silences the cabin depressurization alarms. </p>

   <p>As an 
                                                                  electrical failure worsens, in that scenario another system called 
                                                                  ELMS turns off electrical power to the Air Cycle Machine which 
                                                                  pumps pressurized air into the cabin. The result of ELMS cutting 
                                                                  power means the override vent fails to close again and no new 
                                                                  pressurized air maintains pressure in the cabin. Pilots get no 
                                                                  warning.
</p>
   <img src="https://qph2.c7.quoracdn.net/main-qimg-32850a0c49bcbcdc755b28a329a7f1be" master_h="614" master_w="643" master_src="https://qph2.c7.quoracdn.net/main-qimg-3f984ff743452cb05c098031f2d93d03">

   <p>An incident in 
                                                                  2007 is cited as AD 2007–07–05 by the FAA in which part but not 
                                                                  all of this scenario played out in a B777 at altitude.
</p>

   <p>MH370 may have 
                                                                  been the incident in which the full scenario played out, but of 
                                                                  course Boeing is not keen for MH370 to be found and unlike Airbus 
                                                                  which funded the search for AF447, Boeing contributed nothing to 
                                                                  finding MH370.
</p>

   <p><em>It has emerged 
                                                                  on the 737MAX that larger LEAP-1B engines were unsuited to the 
                                                                  airframe and there is no way now to alter the airframe to balance 
                                                                  the aircraft.
</em></p>
   <img src="https://qph2.c7.quoracdn.net/main-qimg-338e684f11379ed1779300ac81bc1811" master_h="440" master_w="1024" master_src="https://qph2.c7.quoracdn.net/main-qimg-1909d91fa5262e1ac3b6cd344c51a337">

   <p>It also emerged 
                                                                  that the choice to fit engines to this airframe have origins in a 
                                                                  commercial decision to please Southwest Airlines and cancel the 
                                                                  Boeing 757.
</p>

   <p><em>Boeing failed 
                                                                  to provide training or training material to pilots or even advise 
                                                                  them the existence of MCAS. There was a complex two step process 
                                                                  required of pilots in ET302 and JT610 crashes and their QRH 
                                                                  handbook did not explain this: </em></p>

   <p>
   <a target="_blank" href="https://www.dailymail.co.uk/news/article-6851217/Pilots-40-SECONDS-ride-automated-Lion-Air-Ethiopian-Airlines-crashes.html">Boeing pilots had less than 40 SECONDS to over-ride automated 
                                                                  system
</a></p>

   <p><i>The MAX is 
                                                                  an aerodynamically unbalanced aircraft vulnerable to any sort of 
                                                                  disruption, ranging from electrical failure, out of phase 
                                                                  generator, faulty AOA sensor, faulty PCU failure alert, digital 
                                                                  encoding error in the DFDAU. </i>
</blockquote>

<p>
<a target="_blank" href="https://www.quora.com/profile/Jason-Eaton-9">
                                                                                             Jason Eaton
</a>
<g fill="none" fill-rule="evenodd" stroke="#666" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5">
</g>


                                                                                                            Former Service Manager
<g fill="none" fill-rule="evenodd" stroke="#666" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5">
</g>


                                                                                                            Studied at University of 
                                                                                                            Life
<g fill="none" fill-rule="evenodd" stroke="#666" stroke-linecap="round" stroke-width="1.5">
</g>


                                                                                                            Lives in Sydney, 
                                                                                                            Australia
<g fill="none" fill-rule="evenodd" stroke="#666" stroke-width="1.5">
<circle cx="12" cy="12" r="3">
</circle>
</g>


                                                                                                            564k answer views
50.7k 
                                                                                                            this month 
<a target="_blank" href="https://www.quora.com/Would-you-fly-Boeing-737-Max-8-ever-again/answer/Jason-Eaton-9">
                                                                           Answered Mar 24, 2019
</a>
 ·


<blockquote>

   <p>No I wouldn't. 
                                                                  I'm not a pilot or an aerospace technician but I am a mechanical 
                                                                  engineer, so I know a little bit about physics and stuff.
</p>

   <p><i>The 737–8 
                                                                  is carrying engines it was never designed for, that cause it to 
                                                                  become inherently unstable. So unstable in fact, that it can't be 
                                                                  controlled by humans and instead relies on computer aided control 
                                                                  to maintain the correct attitude, particularly during ascent and 
                                                                  descent.
</i></p>

   <p>The MCAS system 
                                                                  is, effectively, a band aid to fix a problem brought about by poor 
                                                                  design philosophy. Boeing should have designed a new airframe that 
                                                                  complements the new engines, instead of ruining a perfectly good 
                                                                  aircraft by bolting on power units it's not designed to carry, and 
                                                                  then trying to solve the resulting instability with software. And 
                                                                  if that isn't bad enough, the system relies on data from just the 
                                                                  one sensor which if it doesn't agree with, it'll force the 
                                                                  aircraft nose down regardless of the pilots' better judgement. </p>

   <p>That might be 
                                                                  ok for the Eurofighter Typhoon but it's definitely not ok for fare 
                                                                  paying passengers on a commercial jetliner. </p>

   <p>So, no. I won't 
                                                                  be flying on a 737–8 until it's been redesigned to fly safely. You 
                                                                  know, like a properly designed aeroplane should.
4.8k
 Views
 
                                                                  ·
   <a target="_blank" href="https://www.quora.com/Would-you-fly-Boeing-737-Max-8-ever-again#">View 36 Upvoters </a></p>
</blockquote>



<!--TAGS: . ~/Perl -->

<!--file:///f:/Public_html/Skeptics/Political_skeptic/Neoliberalism/Deregulation/boeing_737_MAX_fiasco.shtml-->
<!--file:///f:/Public_html/Skeptics/Financial_skeptic/Casino_capitalism/Corruption_of_regulators/faa_corruption.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Neoliberalism/deregulation.shtml-->
<!--file:///f:/Public_html/Bookshelf/Computers/perl.shtml-->
<!--file:///f:/Public_html/Scripting/perl.shtml-->
<!--file:///f:/Public_html/Skeptics/Financial_skeptic/Casino_capitalism/Corruption_of_regulators/index.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/media_military_industrial_complex.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Nationalism/american_exceptionalism.shtml-->
<!--file:///f:/Public_html/Social/Bureaucracy/bureaucracy_as_a_political_coalition.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/NeoliberalismNeoliberal_rationality/index.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Neocolonialism/technoimperialism.shtml-->
<!--file:///f:/Public_html/Bookshelf/Classic/peter_principle.shtml-->
<!--file:///f:/Public_html/Social/Bureaucracy/bureaucratic_avoidance_of_responsibility.shtml-->
<!--file:///f:/Public_html/Skeptics/Political_skeptic/Neocolonialism/War_is_racket/Bulletin/war_is_racket_bulletin2019.shtml-->
</blockquote>



</em></b></i><center><table border="0" width="100"><tr>
<td align="center"><a href="#n20190406X_would_you_fly_boeing_737_max_8_ever_again_quora"><img border="0" src="/Images/up.png" width="16" height="16"></a></td>
<td align="center"><a name="n20190325X_what_do_you_think_of_jared_kushner_getting_ready_to_unveil_his_economic_plan_for_peace" href="#NEWS_TOC"><img border="0" src="/Images/home.gif" width="16" height="18"></a></td>
<td align="center"><a href="#n20190325X_is_jared_kushner_trump_s_son_in_law_the_man_to_bring_peace_to_the_middle_east_quora"><img border="0" src="/Images/down.png" width="16" height="16"></a></td>
</tr></table></center>

<h4>[Mar 25, 2019] <a target="_blank" href="https://www.quora.com/What-do-you-think-of-Jared-Kushner-getting-ready-to-unveil-his-economic-plan-for-peace-in-the-Middle-East"> What do you think of Jared Kushner getting ready to unveil his economic plan for peace in the Middle East</a></h4>

<h5>Notable quotes:</h5>
<h5>"...  He and the rest of his family are all crooks as are most politicians. Deals are made                                               between thieves. Wealth serves as a mask.  ..."</h5>
<blockquote>
<h6>Mar 25, 2019 |  <a target="_blank" href="https://www.quora.com/What-do-you-think-of-Jared-Kushner-getting-ready-to-unveil-his-economic-plan-for-peace-in-the-Middle-East">www.quora.com </a> </h6>
 
<p>
<b>
What do you think of Jared Kushner getting ready to 
                  unveil his economic plan for peace in the Middle East?
</b>
<g stroke="none" fill="none" fill-rule="evenodd">
</g>

<p>
<a target="_blank" href="https://thehill.com/news-by-subject/foreign-policy/429053-kushner-to-unveil-economic-plan-for-middle-east-peace-report">
                  https://thehill.com/news-by-subject/foreign-policy/429053-kushner-to-unveil-economic-plan-for-middle-east-peace-report
</a>
<p>
<a target="_blank" href="https://www.quora.com/profile/Christina-Fabian-5">
                                                      Christina Fabian
</a>
, lives in San 
                                                      Francisco
<a target="_blank" href="https://www.quora.com/What-do-you-think-of-Jared-Kushner-getting-ready-to-unveil-his-economic-plan-for-peace-in-the-Middle-East/answer/Christina-Fabian-5">
                                                      Answered 
Feb 8
</a>
<blockquote>

   <p><em>He and the rest of his family are all crooks as are most politicians. Deals are made 
                                             between thieves. Wealth serves as a mask. </em></p>

   <p>I wonder how much he will make! Am so sick at 
                                             the lack of morals among officials all over the world. Do good becau