Efficient 'uniq' snippet
# Input: @list # Output: @uniqed my %u = (); @uniqed = grep {defined} map { if (exists $u{$_}) { undef; } else { $u{$_}=undef;$_; } } @list; undef %u;
11387 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Justin Mason http://jmason.org
# Input: @list # Output: @uniqed my %u = (); @uniqed = grep {defined} map { if (exists $u{$_}) { undef; } else { $u{$_}=undef;$_; } } @list; undef %u;