Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

In the below code I am checking the value and printing other values if it matches,it works fine from the second array value,
if it matches the first element still it prints .
I tried testing it outside it works perfectly.
print <<EOP; <td width="15%"><B>Event:</B></td> <td width="40%"><select name="Event" size="3" multiple> EOP if($eventChoice ne "999999"){ if($eventChoice =~ /(.*)(\,)(.*)/) { print "<option value='$eventChoice' selected >$3</option>\n"; } print "<option value='999999' >All Events</option>\n"; push @EventList,$eventChoice; &PopulateEventDropDown(@EventList); # EventList with eventchoice } else { print "<option value='999999' selected>All Event +s</option>\n"; &PopulateBasicDropDown(@EventList); # Default E +ventList } print <<EOP; </select> sub PopulateEventDropDown { my($Records); my @Records = @_; my $eventChoice = pop @Records; foreach $Records(@Records) { if($Records =~ /(.*)(\,)(.*)/) { if($Records ne $eventChoice) { print "<option value='$Records'>$3</option>\n" +; } } } #end foreach }

Replies are listed 'Best First'.
Re: Sub Routine
by bschmer (Friar) on Jul 28, 2004 at 19:02 UTC
    Having done nothing beyond giving your code a glance, the first thing that I see is that you have the statement print <<EOP; shortly before the subroutine without a closing EOP. Perhaps that is the problem.
      The Subroutine is in another perl script where I am calling I have copied it here to check what exactly it is.
      Anymore questions ???