Ebaad Ahmed wrote: > > Just used the following code to delete a specific value from an array, populated > from text read from file. Please let me know if i can be of any help. > sub doDeleteProvider { > my $cgi = shift; > my $counter = 0; > my $index; > my $del_name = $cgi->param("names"); > my $TITLE = "Nighthawk Database"; > foreach (@pro_list) { > if($_ eq "$del_name") { ^ ^ The quotes are not useful here.
> $index = $counter; > } > $counter++; > } > print $cgi->header; > print $cgi->start_html($TITLE); > print start_form(); > splice (@pro_list, $index, 1); >From the foreach loop it looks like you want to remove the last occurrence of $del_name from @pro_list. You could also do it like this: foreach ( reverse 0 .. $#pro_list ) { if ( $pro_list[$_] eq $del_name ) { splice @pro_list, $_, 1; last; } } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]