Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Road to a readable path

by jwkrahn (Abbot)
on Apr 15, 2009 at 11:23 UTC ( [id://757638]=note: print w/replies, xml ) Need Help??


in reply to Road to a readable path

I don't know if this will work on Windows but it should:

perl -le "use Env q[@PATH]; print for @PATH"

Replies are listed 'Best First'.
Re^2: Road to a readable path
by Corion (Patriarch) on Apr 15, 2009 at 11:25 UTC

    It does:

    C:\>perl -MEnv=@PATH -le "print for @PATH" C:\WINDOWS\ ...
      And without the quotes:
      C:\>perl -MEnv=@PATH -le print()for@PATH ...
Re^2: Road to a readable path
by John M. Dlugosz (Monsignor) on May 11, 2009 at 20:57 UTC
    Very interesting. I learned two things from that: about the Env module, and using the -l switch to turn print into say. The docs for Env says that $Config::Config{path_sep} is used, so it will handle Windows properly. Looking at the code in Env.pm, I see that split is given two arguments, so trailing nul fields are stripped, which another poster points out is a problem on Unix. Since that is the normal point of using the Env module, perhaps someone should issue a correction? Actually, it will return the nth item as an empty string if asked for, but it will not count it when checking the size, so the loop won't ask for it. It re-splits every time an element is gotten, yuck.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2024-04-24 00:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found