in reply to Re^2: Perl one-liner to remove duplicate entries from PATH
in thread Perl one-liner to remove duplicate entries from PATH
my %path; $path{$_}=$path{$_} || 1 + keys %path for split /$sep/,$path;
there are other more efficient ways to do that btw, im just feeling moderately cheeky. ;-)
And for the curious you cant write that as ||= because of a bug in Perl (on some versions of Perl anyway).
Update:
Or maybe its not a bug. According to some the docs should be read to say that it should be valid to saymy %path; $path{$_}||=keys %path for split /$sep/,$path;
and some are saying that the results are undefined. sigh
|
---|