urgh..it's not homework...here's my example script...please help...

#!/usr/bin/perl ##BILLING PROGRAM## use strict; my(@data,@data2); ##open needed files to use in program open(FILE, "../Counts/newdata.txt") or die "Can't open file: $!\n"; open(FILE2, "../Counts/info.csv") or die "Can't open file: $!\n"; ##throw files into arrays and define arrays chomp(@data = <FILE>); chomp(@data2 = <FILE2>); ##define hash my ($id,$name,$srid); my %keyhash = ( $id => { NAME => $name, SRID => $srid, CSV => [] } ); ##populate arrays: foreach ( @data ) { ##define variables my ($id,$name,$srid) = split /,/; # Add some error checking to make sure the # hash key $id does not already exist $keyhash{$id} = { NAME => $name, SRID => $srid, CSV => [], } } ##print unused ids from csv file print "\n\nUnused ids from csv file\n"; print "--------------------------\n"; foreach ( @data2 ) { my ($id,$name,$srid) = split /,/; # Warn and do nothing if a record is found for which the # $name is not already in %keyhash unless ( defined( $keyhash{$name} ) ) { warn "No such record $id!\n"; next; } push @{$keyhash{$id}{CSV}}, [ $name, $srid ]; } ##Finally, extract the number of records for each customer ##print column headers print "\n\n"; print "Customer #of docs\n"; print "-------------------------\n"; # A little something to get the plurality correct foreach ( keys %keyhash ) { my $num = @{$keyhash{$_}{CSV}}; printf "%s %d\n", $keyhash{$_}{NAME}, $num, } ##just formatting by adding a couple returns at the end of the printou +t print "\n\n"; ##my choice of data structures ( hashes instead of arrays ) is dependa +nt ##on how we want to use the data later. ##close files close (FILE); close (FILE2); ##exit program exit;


Here it is. Thanks for beating me up :) ..

In reply to Re: Re: oh boy! by qball
in thread oh boy! by qball

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.