"Second, if one is on contract, Perl can be Very useful
for earning money.  Read the report program below and
keep in mind that 'cad.passwd' is 11,000 lines of text
and 'simplex.passwd' is more than 300.

        #! /usr/local/bin/perl
        open (CAD, "cad.passwd");
        while (<CAD>) {
         chomp;
         @cad = split /:/;
         open (SIMPLEX, "simplex.passwd");
         while (<SIMPLEX>) {
            chomp;
            @simplex = split /:/;
            if ( $cad[0] eq $simplex[0] ) {
                        if ($cad[2] ne $simplex[2]) {
                        print "C: @cad\n";
                        print "S: @simplex\n\n";
                 }
            }
         }
         close SIMPLEX;
        }
        close CAD;
"

and I of course felt MORALLY compelled to argue against
the loop through the SIMPLEX file for each entry in
the CAD file.... and proposed

p1: you dinna mind a recommendation on your script:

        #! /usr/local/bin/perl -w
        use strict;
        #
        # our two files - modify as needed
        #
        my ( $sim_file, $cad_file) = qw(simplex.passwd cad.passwd);
        
        my %simplix_hash;
     open (SIMPLEX,$sim_file) or die "unable to open $sim_file :$!\n";

     #
     # read in our simplex file first to fill the hash for subsequent
     # look ups...
     while (<SIMPLEX>) {
         chomp;
         my @sim = split /:/;
         $simplix_hash{$sim[0]} = \@sim;
        }
     close SIMPLEX;

        open (CAD, $cad_file) or die "unable to open $cad_file :$!\n";
        while (<CAD>) {
         chomp;
         my @cad = split /:/;
         if ( exists($simplix_hash{$cad[0]}) ) {

                        print "C: @cad\nS: @{$simplix_hash{$cad[0]}\n\n";
                unless ($cad[2] eq @{$simplix_hash{$cad[0]}}[2]) ;
         }
        }
        close CAD;

since it appeared the Moral Imperative to read it but once
and then use a bit of dereferencing of the hashed data.....

but doesn't this lead to the core problem that we are
now putting all of those people out of work? Including
the Project Manager who felt that this problem would
take a mythical man month....

ciao
drieux

---

ps: is this when I fess up to having read the
learning perl book this morning and decided that
beginner's either should read it and heed it -
or that it should be banned for reasons of national security?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to