home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / perl / 5685 < prev    next >
Encoding:
Internet Message Format  |  1992-09-02  |  1.8 KB

  1. Path: sparky!uunet!cs.utexas.edu!sun-barr!rutgers!orstcs!prism!
  2. From: @prism.cs.orst.edu
  3. Newsgroups: comp.lang.perl
  4. Subject: Why doesn't this work?
  5. Message-ID: <1992Sep02.191014.28892@CS.ORST.EDU>
  6. Date: 2 Sep 92 19:10:14 GMT
  7. Sender: usenet@CS.ORST.EDU
  8. Distribution: usa
  9. Organization: Oregon State University, Computer Science Dept
  10. Lines: 55
  11. Nntp-Posting-Host: prism.cs.orst.edu
  12.  
  13. Why doesn't this work?
  14.  
  15.    while ( ($eval) = ($path =~ /(\`.*\`)/) ) {
  16.       $val = "";
  17.       if ( $eval ) {
  18.          $val = eval( $eval );
  19.          chop $val;
  20.       }
  21.       $path =~ s/$eval/$val/;
  22.    }
  23.  
  24.  
  25. Here's what's happening via the debugger:
  26.  
  27. main'(explode:168):   while ( ($eval) = ($path =~ /(\`.*\`)/) ) {
  28.   DB<2> print $path
  29. Researchers/`echo David D. Perkins--071160 | cut -f1 -d-`/Fungi/collection_rec
  30.   DB<3> s
  31. main'(explode:169):      $val = "";
  32.   DB<3> s
  33. main'(explode:170):      if ( $eval ) {
  34.   DB<3> p $eval
  35. `echo David D. Perkins--071160 | cut -f1 -d-`
  36.   DB<4> s
  37. main'(explode:171):         $val = eval( $eval );
  38.   DB<4> s
  39. main'((eval):1):        `echo David D. Perkins--071160 | cut -f1 -d-`;
  40. ((eval):2):     ;
  41.   DB<4> s
  42. main'(explode:172):         chop $val;
  43.   DB<4> s
  44. main'(explode:174):      $path =~ s/$eval/$val/;
  45.   DB<4> p $val
  46. David D. Perkins
  47.   DB<5> p $eval
  48. `echo David D. Perkins--071160 | cut -f1 -d-`
  49.   DB<6> p $path
  50. Researchers/`echo David D. Perkins--071160 | cut -f1 -d-`/Fungi/collection_rec
  51.   DB<7> s
  52. main'(explode:168):   while ( ($eval) = ($path =~ /(\`.*\`)/) ) {
  53.   DB<7> p $path
  54. Researchers/David D. Perkins| cut -f1 -d-`/Fungi/collection_rec
  55.  
  56.  
  57.  
  58. Can someone help me out here?  It seems that nothing after the "|"
  59. is being replaced.  What I had hoped would be in $path is
  60. Researchers/David D. Perkins/Fungi/collection_rec
  61. But that's not happening.  Any help would be appreciated...
  62.  
  63.  
  64. --
  65. Rebecca Jacobsen
  66. rydenb@cs.orst.edu
  67. Microbial Germplasm Database Project
  68.