vaevictus has asked for the wisdom of the Perl Monks concerning the following question:
Reports "Use of uninitialized value in string eq at ./m2.cgi line 31." ...#!/usr/bin/perl -w use strict; use CGI qw/:standard/; print header; my @holder; open (FILE, "tempfile"); @holder=<FILE>; close FILE; my @theaters; my $name; my $link; my $info; my $rating; my $length; my $map; my $times; my $phone; my $mode; my $counter=-1; my $moviecounter=-1; my $internal=0; foreach my $line (@holder) { $internal++; if($line =~ m/<!-- LHS movie -->/) { //THIS IS THE LINE REPORTED A +S UNINITIALIZED. $mode ="LHS"; $moviecounter++; $internal=0; } elsif ($line =~ m/<!-- RHS movie -->/) { $mode = "RHS"; $moviecounter++; $internal=0; } elsif ($line =~ m/<!-- theater -->/) { $mode = "theater"; $counter++; $moviecounter=-1; $internal=0; } elsif ($mode eq "LHS") { if ($internal == 6 ) { ($link,$name)=$line=~m/<a href=\"(.*)\">(.*)<\/a>/; $theaters[$counter]{'movies'}[$moviecounter]{'name'}=$name; $theaters[$counter]{'movies'}[$moviecounter]{'link'}=$link; } elsif ( $internal == 7 ) { ($rating,$length)=$line=~m/<small>(.*)\ \ \ (.*)< +\/small>/; $theaters[$counter]{'movies'}[$moviecounter]{'rating'}=$rating; $theaters[$counter]{'movies'}[$moviecounter]{'length'}=$length; } elsif ( $internal == 9 ) { ($times)=$line=~m/<Br>([^\&]*)/; $theaters[$counter]{'movies'}[$moviecounter]{'times'}=$times; } } elsif ($mode eq "RHS") { if ($internal == 4 ) { ($link,$name)=$line=~m/<a href=\"(.*)\">(.*)<\/a>/; $theaters[$counter]{'movies'}[$moviecounter]{'name'}=$name; $theaters[$counter]{'movies'}[$moviecounter]{'link'}=$link; } elsif ($internal == 5) { ($rating,$length)=$line=~m/<small>(.*)\ \ \ (.*)< +\/small>/; $theaters[$counter]{'movies'}[$moviecounter]{'rating'}=$rating; $theaters[$counter]{'movies'}[$moviecounter]{'length'}=$length; } elsif ($internal == 7) { ($times)=$line=~m/<Br>([^\&]*)/; $theaters[$counter]{'movies'}[$moviecounter]{'times'}=$times; } } elsif ($mode eq "theater"){ if ($internal == 4 ) { ($link,$name)= $line=~m/<Br><A HREF=\"(.*)\"><b>(.*)<\/b><\/a>/; $theaters[$counter]{'link'}=$link; $theaters[$counter]{'name'}=$name; } elsif ($internal == 5) { ($info)=$line=~m/.*>(.*)/; $theaters[$counter]{'info'}=$info; } elsif ($internal == 6) { ($phone)=$line=~m/.*;(.*)/; $theaters[$counter]{'phone'}=$phone; } elsif ($internal == 7) { ($map)=$line=~m/<A HRef=\"(.*)\">/; $theaters[$counter]{'map'}=$map; } } }
... any ideas?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: uninitialized weirdness
by tye (Sage) on Nov 17, 2000 at 00:08 UTC | |
by Dominus (Parson) on Nov 17, 2000 at 08:31 UTC | |
|
Re: uninitialized weirdness
by Dominus (Parson) on Nov 17, 2000 at 00:11 UTC | |
|
Re: uninitialized weirdness
by vaevictus (Pilgrim) on Nov 17, 2000 at 01:04 UTC | |
|
Re: uninitialized weirdness
by arturo (Vicar) on Nov 17, 2000 at 00:02 UTC | |
by vaevictus (Pilgrim) on Nov 17, 2000 at 00:04 UTC | |
|
Re: uninitialized weirdness
by turnstep (Parson) on Nov 16, 2000 at 23:53 UTC |