Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Disclaimer: The script worked great, so no worries about getting it functional. Just looking for some commentary :)

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.

In reply to My first USEFUL script! by nefigah

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-03-28 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found