Gossamer Forum
Home : General : Perl Programming :

Re: [courierb] push new element to array

Quote Reply
Re: [courierb] push new element to array In reply to
Hi,

Below should work

@myNames = ('Moe', 'Shemp', 'skie','blah');
$newdefined = $new;
my %myNames = map{$_ => 1} @myNames ;
if(exists $myNames{"$newdefined"}){
print "$newdefined was registered";
}else{
push(@myNames,$newdefined );
}

Hope that helps!

Cheers,

Dat

Programming and creating plugins and templates
Blog
Subject Author Views Date
Thread push new element to array courierb 10375 Sep 28, 2007, 12:21 PM
Thread Re: [courierb] push new element to array
tandat 10069 Sep 29, 2007, 12:35 AM
Thread Re: [tandat] push new element to array
Wychwood 10088 Sep 29, 2007, 2:11 AM
Post Re: [Wychwood] push new element to array
courierb 9963 Sep 30, 2007, 6:41 AM
Post Re: [Wychwood] push new element to array
courierb 9989 Sep 30, 2007, 6:51 AM
Post Re: [tandat] push new element to array
courierb 9983 Sep 30, 2007, 6:53 AM
Thread Re: [tandat] push new element to array
courierb 9940 Oct 1, 2007, 1:02 AM
Thread Re: [courierb] push new element to array
tandat 9921 Oct 1, 2007, 5:36 AM
Post Re: [tandat] push new element to array
courierb 9863 Oct 1, 2007, 1:58 PM
Thread Re: [tandat] push new element to array
courierb 9858 Oct 1, 2007, 3:34 PM
Thread Re: [courierb] push new element to array
tandat 9844 Oct 1, 2007, 6:59 PM
Thread Re: [tandat] push new element to array
courierb 9831 Oct 2, 2007, 4:35 AM
Post Re: [courierb] push new element to array
courierb 9764 Oct 3, 2007, 12:09 AM