Question: I have a menu that is dynamically created. When the user selects a value, I need to get that value and use it for a query statement. This is not a form, just a menu on the page.

I have:

```
<select name="topic" id="topic">
          <option value="optiont" selected="selected">Select topic...</option>
          <?php
           while ($row = mysqli_fetch_array($sql))
          {
            echo "<option value=\"optiont$count\" name=\topic[]\">" . $row['topic'] . "</option>";
            $count++;
          }
          ?>
        </select>

```

I want to know which option is selected. How can I do this??

Answer: 
You can simply go get more lines at that point:

```
while (<FILE>) {
  if (m/Research Interests/) {
    while (<FILE>) {
      if (m/<p>(.*)<p>/) {
        print "Research Interests: $1";
        last;
      }
    }
  }
}

```

I don't know whether your file is huge or not, but it's worth learning techniques that don't require reading the whole file at once so that you can deal with arbitrarily large files, or with streams.
If you absolutely have to do this, you could try setting the newline separator to undef:

```
#!/usr/bin/perl
use warnings;
use strict;

my $infile = 'in.txt';
open my $input, '<', $infile or die "Can't open to $infile: $!";

my $reserch_interests;
$/=undef;
while(<$input>){
        if($_ =~ /(Research Interests)/){
            $reserch_interests = $1;
                if($_=~ m/<p>(.*)<\/p>/){
                        print "Title: $reserch_interests\nInterests: $1\n";
                }
        }

}

```

Prints:

```
Title: Research Interests
Interests: Data mining, databases, information retrieval

```