Newbie again.
Sorry if this question sounds so silly

Want to open filenames like ~username/blah but open doesn't interpret the tilde to 
mean the
home directory

Solution 

expand the filename manually with substitution

$filename =~ s{ ^  ~  ( [^/]* ) }
                      { $1
                           ? (getpwnam($1)) [7]
                           : ( $ENV{HOME} || $ENV{LOGDIR}
                                  || (getpwuid($>)) [7]
                                     )
}ex;

The auther says the following can me matched
~user
~user/blah
~
~/blah

Could someone make me clear how these can be matched by the pattern inside the 
parenthesis 
which is ( [^/]*)

Thanks in advance

Reply via email to