i dont't know where im going wrong. can sombody please tell me what this means?
Missing $ on loop variable at measurements2.pl line 69.
here is my code...
#!/usr/local/bin/perl use strict; use warnings; my $path='CustData.txt'; my @range = ("10-20", "20-30", "30-40", "41-50", "51-60", "61-70", "71 +-80","81-90", "91-99"); my @count; my @percent; my %HoH; open(DATA, "<$path") || die "Couldn't open $path for reading: $!\n"; my $output; open my $fd, '>', \$output or die "open: $!"; while (<DATA>) { chomp; my ($id, $title, $surname, $forename, $sex, $dob, $vision) = split +(/,/); $HoH{$id} = {'title' => $title, 'surname' => $surname, 'forename' +=> $forename, 'sex' => $sex, 'dob' => $dob, 'vision' => $vision,}; } close(DATA); my $range1=1; my $range2=10; my $range3=1; my $range4=10; my $person_count=0; sub personCount { my ($x,$y) = @_; my ($vision_total,$person_count)=0; foreach my $id (sort keys %HoH) { if( ($HoH{$id}->{'vision'}>=$x) & ($HoH{$id}->{'vision'}<=$y) +) { ++$person_count; $vision_total=$vision_total+$HoH{$id}->{'vision'}; } } return int($person_count); } sub percent { my ($x,$y) = @_; my $percent = 0; my ($total_person_count,$vision_total,$person_count)=0; foreach my $id (sort keys %HoH) { ++$total_person_count; } foreach my $id (sort keys %HoH) { if( ($HoH{$id}->{'vision'}>=$x) & ($HoH{$id}->{'vision'}<=$y) +) { ++$person_count; $vision_total=$vision_total+$HoH{$id}->{'vision'}; } } return $percent = ($person_count/$total_person_count)*100; } print $fd ("Range\t"); foreach (@range) { printf $fd ("%7s", $_); } print $fd ("\n"); for my ($counter=0;$counter<9;$counter++) { $range3=$range3+10; $range4=$range4+10; my $personCount = personCount($range3,$range4); push (@count, $personCount); } print $fd ("Count\t"); foreach (@count) { printf $fd ("%7s", $_); } print $fd ("\n"); for my ($counter=0;$counter<9;$counter++) { $range1=$range1+10; $range2=$range2+10; my $percent = sprintf("%.0f", percent($range1,$range2)); push (@percent, $percent); } print $fd ("Percent\t"); foreach (@percent) { printf $fd ("%7s", $_); } print $fd ("\n"); print $fd ("\n"); close $fd;

In reply to Missing $ on loop variable at measurements2.pl line 69. by Yoda_Oz

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.