IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2404


Ignore:
Timestamp:
Nov 22, 2004, 7:03:47 PM (22 years ago)
Author:
jhoblitt
Message:

add array & hash subscripts

File:
1 edited

Legend:

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

    r2403 r2404  
    1 %%% $Id: perlCodeConventions.tex,v 1.27 2004-11-23 04:24:52 jhoblitt Exp $
     1%%% $Id: perlCodeConventions.tex,v 1.28 2004-11-23 05:03:47 jhoblitt Exp $
    22\documentclass[panstarrs]{panstarrs}
    33
     
    10821082\end{verbatim}
    10831083
     1084\subsubsection{Array Subscripts}
     1085
     1086Use ``cuddled'' brackets \code{[]} when accessing an array element.
     1087
     1088\begin{verbatim}
     1089    $foo[-1];                           # Correct
     1090    (someSub($foo))[1];                 # Correct
     1091    $foo[ 6 ];                          # AVOID!
     1092\end{verbatim}
     1093
     1094\subsubsection{Hash Subscripts}
     1095
     1096Use ``cuddled'' brackets \CODE.{}. when accessing a hash element.  It is
     1097acceptable to use ``bare-words'' as a hash key (Note: this rule may be subject
     1098to change).
     1099
     1100\begin{verbatim}
     1101    $foo{bar};                          # Correct
     1102    $foo{$baz};                         # Correct
     1103    $foo{'fiddle'};                     # Correct
     1104    $foo{ lish };                       # AVOID!
     1105    $foo{ 'zab' };                      # AVOID!
     1106\end{verbatim}
     1107
     1108
    10841109%------------------------------------------------------------------------------
    10851110\appendix                               %Begin Appendices
Note: See TracChangeset for help on using the changeset viewer.