Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array - Unique Values (Push) 1

Status
Not open for further replies.

Extension

Programmer
Nov 3, 2004
311
CA

I want to populate an array but I want to only "push" unique values.

Code:
@array = (213,215,213,215,245,120);

foreach my $Numbers (@array) {

	if ($Numbers > 200) {
		push(@NewNumbers,$Number);
	}
}

With the example above, the "215" is getting pushed twice while I simply want to unique ones.

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top