IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 12, 2004, 5:10:47 PM (22 years ago)
Author:
jhoblitt
Message:

add foreach loops

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/misc/perlCodeConventions.tex

    r2359 r2360  
    1 %%% $Id: perlCodeConventions.tex,v 1.11 2004-11-13 02:57:30 jhoblitt Exp $
     1%%% $Id: perlCodeConventions.tex,v 1.12 2004-11-13 03:10:47 jhoblitt Exp $
    22\documentclass[panstarrs]{panstarrs}
    33
     
    2121\RevisionsStart
    2222% version     Date         Description
    23 01 & 2004/11/08 & Title Changed \\
     2301 & 2004-11-08 & Title Changed \\
    2424\RevisionsEnd
    2525
     
    795795\subsection{Perl style for, foreach Statements}
    796796
    797 \begin{verbatim}
     797A Perlish \code{for} or \code{foreach} statement (also known as an iterator)
     798should have the folliwng form:
     799
     800\begin{verbatim}
     801foreach my $item (@workingList) {
     802    # do stuff with $item
     803}
     804\end{verbatim}
     805
     806The current working item should be interacted with through a declared lexical
     807variable and  not via \code{$_}.
     808
     809\begin{verbatim}
     810foreach (@workingList) {                # Avoid!
     811    # do stuff with $_
     812}
    798813\end{verbatim}
    799814
Note: See TracChangeset for help on using the changeset viewer.