Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Perl Path Editor for Unix

by greenFox (Vicar)
on Sep 14, 2005 at 07:53 UTC ( #491782=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl Path Editor for Unix
in thread Perl Path Editor for Unix

Not quite matching your spec but here you go. I implemented as much as I would use...

my %path; my ($high, $low) = (0,0); for (split /:/, $ENV{PATH} ){ next if exists $path{$_}; # remove duplicates $path{$_} = $high; ++$high; } for (@ARGV){ /^-(.*)/ and do {delete $path{$1} if exists $path{$1}; next;}; /^\+\+(.*)/ and do {--$low; $path{$1}=$low unless exists $path{$1}; +next;}; /^\+(.*)/ and do {++$high; $path{$1}=$high unless exists $path{$1}; +next;}; } print join ":", sort {$path{$a} <=> $path{$b} } keys %path; print "\n";

--
Murray Barton
Do not seek to follow in the footsteps of the wise. Seek what they sought. -Basho


Comment on Re^2: Perl Path Editor for Unix
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://491782]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2014-07-13 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (247 votes), past polls