my($ca,$b);
while (($data) = $sth->fetchrow_array) {

     if($data =~ /^A$/i) {
     print "<a name=\"A\"></a>" unless $ca;
     $ca = 1;
     }
     if($data =~ /^B$/i) {
     print "<a name=\"B\"></a>" unless $cb;
     $cb = 1;
     }
}

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of
steve silvers
Sent: Thursday, January 02, 2003 10:59 PM
To: [EMAIL PROTECTED]
Subject: Find and stop and first instance of (A,B,C,...)


I'm getting rows from my database and ordering them by name ASC. So they 
come in in alphabetical order. I want to find the first instance of the 
letters in the alphabet.

while (($data) = $sth->fetchrow_array) {

     if($data =~ /^A$/i) {
     print "<a name=\"A\"></a>";
     }
     if($data =~ /^B$/i) {
     print "<a name=\"B\"></a>";
     }
}

And so on.... But I only want to print the <a name> tag at only the first 
instance of "A" not all of them, and this goes for the rest on them also. 
Any suggestions on this would be greatly appreciated.

Thanks in advance.
Steve



_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to