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

Re: Re: How to convert unix ~path (tilde) to full path

by Rich36 (Chaplain)
on Apr 05, 2002 at 17:23 UTC ( [id://156996]=note: print w/replies, xml ) Need Help??


in reply to Re: How to convert unix ~path (tilde) to full path
in thread How to convert unix ~path (tilde) to full path

Zaxo speaks the truth... Adapted from The Perl Cookbook (pg.231)...

my $file = '~rich36/perl/makeperl'; $file =~ s{ ^ ~ ( [^/]* ) } { $1 ? (getpwnam($1))[7] : ( $ENV{HOME} || $ENV{LOGDIR} || (getpwuid($>))[7] ) }ex; print "$file"; __DATA__ /home/users/rich36/perl/makeperl

Rich36
There's more than one way to screw it up...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-03-29 10:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found