home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / perl / 5405 < prev    next >
Encoding:
Text File  |  1992-08-20  |  1.0 KB  |  31 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!kithrup!hoptoad!decwrl!mips!carbon!news.cs.indiana.edu!syscon!gator!fang!att!cbnewsc!cbnews!daleske
  3. From: daleske@cbnews.cb.att.com (John D. Daleske)
  4. Subject: Filename expansion ("~user")
  5. Organization: Stratus Computers, Inc.
  6. Distribution: usa
  7. Date: Thu, 20 Aug 1992 15:37:27 GMT
  8. Message-ID: <1992Aug20.153727.167@cbnews.cb.att.com>
  9. Keywords: ~user filename expansion
  10. Sender:  John Daleske
  11. Lines: 18
  12.  
  13. I'm relatively new to Perl and love it.  I've read the recent notes in this
  14. notes group and have not found how do one capability that I am trying to
  15. use in a Perl script which is the ~user filename expansion.  Following is a test
  16. script:
  17.  
  18. $tst1="~daleske";
  19. die "${tst1} not a directory" if !(-d ${tst1});
  20. opendir(DH, ${tst1});
  21. @allfiles = readdir(DH);
  22. closedir(DH);
  23. print "@allfiles\n";
  24.  
  25. If I set $tst1 to the full pathname it works fine.  I'd like to use the common
  26. facility of ~user to avoid needing to know the full path name.  (User home
  27. directories do get moved around.)
  28.  
  29. Suggestions are appreciated!
  30. John
  31.