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
In reply to Re: Re: How to convert unix ~path (tilde) to full path
by Rich36
in thread How to convert unix ~path (tilde) to full path
by mtr4cv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |