So I use OS X Leopard (my first real experience with a Unix-like system, so I'm a noob in that area too), which comes with 5.8.8. After reading about some of the cool stuff in 5.10 I decided to go for it, and put it in /usr/local. I then wanted everything to use the new install by default, and not knowing anything really about how $PATHs work, here is the method I used:
use File::Basename;
my @local = map {basename $_} grep 1 > -M, </usr/local/bin/*>;
my @files = grep -e, map "/usr/bin/$_", @local;
rename $_, "$_.5.8" for @files;
symlink "/usr/local/bin/$_", "/usr/bin/$_" for @local;
I tried to apply what I learned about grep and map from my previous thread, but I went and used $_ explicitly again :\ (it's just too convenient).
I know in the future I'd want a better initial test than "files modified today" like what I used in the first line... it just seemed like the easiest way to get all the binaries created by the just-completed perl install.
I was very impressed that it ended up taking 4 lines of code!
So, on a scale of 1 to Retarded, how did it turn out?
Braces himself.