Created
May 30, 2017 17:30
-
-
Save 0xAF/3d82ab50515c4a1c6762a1ea9bac3846 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub remove_and_prepend_path { | |
my $arr = shift; | |
my $path = shift; | |
my @backup; | |
while (@{$arr}) { | |
my $p = shift @{$arr}; | |
unshift @backup, $p unless ($p eq $path); | |
} | |
unshift @{$arr}, shift @backup while (@backup); | |
unshift @{$arr}, $path; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment