Error "Use of uninitialized value "

Discussion in 'Perl Misc' started by geek, Mar 22, 2005.

  1. geek

    geek Guest

    Hi all,

    I am getting the error of "Use of uninitialized value" in the line
    "else { stat();}"

    Any help will be appreciated. Look at the bottom for the code .

    #########################################################
    sub stat {
    print header(), start_html("The Statistics for Administrator");
    open(fileHandle,"./outputFile") or die "The file cannot be opened";
    my @fileData = <fileHandle>;
    my $count1=0;
    my $count2=0;
    my $count3=0;
    my $count4=0;
    my $count5=0;
    my $count6=0;
    my $count7=0;
    my $count8=0;
    my $count9=0;
    my $countt=0;
    # my @array;
    foreach my $word(@fileData){
    print "******$word";
    my @array=split(/ /, $word);

    foreach my $element(@array){
    if($element eq "CS5375"){
    $count1++;
    }
    if($element eq "cd"){
    $count2++;
    }
    if($element eq "cp"){
    $count3++;
    }
    if($element eq "vim"){
    $count4++;
    }
    if($element eq "%ls-l"){
    $count5++;
    }
    if($element eq "man"){
    $count6++;
    }
    if($element eq "perl-v"){
    $count7++;
    }
    if($element eq "all"){
    $count8++;
    }
    if($element eq "finger"){
    $count9++;
    }
    if($element eq "ftp\n"){
    $countt++;
    # print "hello";
    }
    }
    }

    my $noLine=0;
    open( fileHandle,"<./outputFile");
    $noLine++ while <fileHandle>;
    print "Number of lines in the file is $noLine";
    my $noUsers= $noLine/2;
    print br;
    print "Number of users is $noUsers";
    print br;
    my $finalAvg=0;
    open(handGrade,"./gradeFile") or die "gradeFile cannot be opened";
    my @avgarr = <handGrade>;
    my $tmpAvg;
    foreach my $avg(@avgarr){
    $tmpAvg="$finalAvg"+"$avg";
    $finalAvg=$tmpAvg/2;
    }
    print "The average is $finalAvg";
    print br;
    my $percentage1=($count1/$noUsers)*100;
    print " The percentage for first question is $percentage1";
    my $percentage2=($count2/$noUsers)*100;
    print br;
    #####################################################################
     
    geek, Mar 22, 2005
    #1
    1. Advertising

  2. geek

    John Bokma Guest

    John Bokma, Mar 22, 2005
    #2
    1. Advertising

  3. geek

    Guest

    "geek" <> wrote:
    > Hi all,
    >
    > I am getting the error of "Use of uninitialized value" in the line
    > "else { stat();}"
    >
    > Any help will be appreciated. Look at the bottom for the code .


    That line does not appear in your code.

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
     
    , Mar 22, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. G Kannan
    Replies:
    1
    Views:
    1,255
    Eric J. Roode
    Oct 11, 2003
  2. Sukhbir Dhillon
    Replies:
    1
    Views:
    6,278
    Joe Smith
    Apr 5, 2004
  3. smartins68
    Replies:
    1
    Views:
    6,023
    Joe Smith
    Jun 9, 2004
  4. geek
    Replies:
    21
    Views:
    220
    Sherm Pendley
    Mar 24, 2005
  5. geek
    Replies:
    2
    Views:
    154
    Brian McCauley
    Mar 23, 2005
Loading...

Share This Page