Mathew Snyder wrote: > Figured it out. > > New question though. Here's my code: > > #!/usr/bin/perl > use DBI; > use strict; > > my $dbh = DBI->connect ( "dbi:mysql:dbname=rt3_devel;host=10.0.2.27", > "svr", "XXXXXXXX") or die "Cannot connect to database!\n"; > > my $sth = $dbh->prepare("SELECT DISTINCT Content FROM > ObjectCustomFieldValues") or die "Cannot prepare statement: $DBI::errstr\n"; > > $sth->execute; > > my @profiles; > while (my $profile = $sth->fetchrow()){ > # next if $profile = "Routine"; > # next if $profile = "Normal"; > # next if $profile = "Unusual"; > push(@profiles, $profile); > } > > foreach (@profiles){ print $_ . "\n" }; > > $sth->finish; > > > I need to skip three items in the database and not have them placed in > the array. However, if I use next such as the lines commented out above > I get no output whatsoever. Even uncommenting one gives me nothing. > How do I tell the script to discard the three items but continue to > populate the database with everything else?
You are using the assignment operator (=) so $profile is always true. You need to use a string comparison operator instead: next if $profile eq 'Routine'; next if $profile eq 'Normal'; next if $profile eq 'Unusual'; John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>