That does what I need when strings match. However when strings don't match the db is unchanged from the original, wheras I need the contents of @in pushed into @db:#!/usr/bin/perl -w #use strict; use CGI ':standard'; my @db = (1, 3, 5, 7, 9, 11); my @in = (1, 2, 5, 8, 9, 10, 13); my $var = 7; # I have this variable available to indicate the length o +f the array my (%db_lookup, %in_lookup); @db_lookup{@db} = (); @in_lookup{@in} = (); $count = 0; while ($count < $var) { if (exists $in_lookup{$count}, @db) { @db = grep { not exists $in_lookup{$_} } @db; $count += 1; } elsif (not exists $in_lookup{$count}, @db) { push @db, grep { not exists $db_lookup{$_} } @in; $count += 1; } } print "view: @db";
Where am I going wrong?my @db = (1, 3, 5, 7, 9, 11); my @in = (21, 22, 25, 28, 29, 210, 213);
In reply to Re: Re: Help needed to make a conditional statement
by jonnyfolk
in thread Help needed to make a conditional statement
by jonnyfolk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |