Re: Fields won't add when reading a text file



NevadaSam@xxxxxxxxx wrote:
This is the script I have been working on all day and the text file which it reads follows it.

<script and data snipped>

These are a few hints:

The numbers represent which seminar by 1-Computer Maintenance, 2-Microsoft Office, 3-Unix Essentials, and 4-CGI/Perl.

You need to tell Perl that, too. This is one way to do so:

my %translate = (
1 => 'Computer Maintenance',
2 => 'Microsoft Office',
3 => 'Unix Essentials',
4 => 'CGI/Perl',
);

And in the loop:

$sem_count{ $translate{$seminar} } ++;

As regards the number of names/records, you can just use the @records array in scalar context:

print "<br /><br />Total registered: " . @records . "\n";

Your use of a @name_count array is incorrect, and generates a bunch of warnings if warnings are enabled (which should be the case...).

Warnings may give you a couple of other hints.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.



Relevant Pages

  • Re: Oh Boy, Polar Lights Enterprises
    ... RLM wrote: ... I'm assuming there's at least a couple folks out there who have actually ... Any hints, warnings or glaring stuff that I need ...
    (rec.models.scale)
  • Re: Component pet peeves
    ... Hints and warnings may not, strictly, mean careless coding, ... but no hints and warnings is certainly an indicator that, ...
    (borland.public.delphi.non-technical)
  • Re: Hints/Warnings gezielt abschalten?
    ... Ich setze lieber ein dummy Statement in meinen Code rein, mit dem Kommentar "keep the compiler happy", als mir ständig Hints und Warnings um die Ohren schlagen zu lassen. ...
    (de.comp.lang.delphi.misc)
  • Re: Component pet peeves
    ... that the developer took care when writing the code. ... IMHO, absence of hints and warningsprominently means that who wrote the code did the things ... The warnings that cannot be avoided are - for example - the ones ...
    (borland.public.delphi.non-technical)
  • Re: Component pet peeves
    ... Hints and warnings may not, strictly, mean careless coding, ... but no hints and warnings is certainly an indicator that, ... Nick Hodges -- TeamB ...
    (borland.public.delphi.non-technical)