#!/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>(.*)\&nbsp;\&nbsp;\&nbsp;(.*)< +\/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>(.*)\&nbsp;\&nbsp;\&nbsp;(.*)< +\/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; } } }
Reports "Use of uninitialized value in string eq at ./m2.cgi line 31." ...

... any ideas?


In reply to uninitialized weirdness by vaevictus

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.