Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!/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

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-05-20 07:05 GMT
Find Nodes?
    Voting Booth?

    No recent polls found