KW.pm Perl Style Guides #14

Slash Style Guide: Coding Principles 3

  • Use tests.

    • (this is all they say about tests. More about this later.)

  • Filehandles and Globs

    • use opendir() and readdir(). don't use the glob operator glob("*") or <*>

      • portability / consistency

    • use Slash's filehandle function; it works like a regular filehandle, but you can use it like a regular variable

      • lexical

      • don't need to use *FILE to pass to a subroutine. In fact, don't use symbol-table globs.

                  use Slash;
                  my $fh = gensym();
                  open $fh, "< $file" or die $!;

<< Previous | Index | Next >> Copyright © 2002 Daniel Allen