home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!boulder!ucsu!spot.Colorado.EDU!farnham
- From: farnham@spot.Colorado.EDU (Farnham Dave)
- Subject: Bug with $number variables ???
- Message-ID: <1992Aug19.040708.519@ucsu.Colorado.EDU>
- Sender: news@ucsu.Colorado.EDU (USENET News System)
- Nntp-Posting-Host: spot.colorado.edu
- Organization: University of Colorado, Boulder
- Date: Wed, 19 Aug 1992 04:07:08 GMT
- Lines: 41
-
-
- Consider the small code fragment below:
-
- ---------------------------------------------
- $search_str = "^farnham:";
-
- open (PASS, "/etc/passwd");
-
- while ($line = <PASS>) {
- if ($line =~ /($search_str).*:.*:.*:.*:.*:(.*)$/) {
- ($login = $1) =~ s/:$//; # remove ':'
- $shell = $2;
- print "Name <$login> Shell <$shell>\n";
- }
- }
- ---------------------------------------------
-
- The two lines I'm referring to are:
- ($login = $1) =~ s/:$//; # remove ':'
- $shell = $2;
-
- In PL-35 "$2" has vanished. It appears that after a
- substitute all the $number variables get reset to null
- even if I don't do another capture.
-
- This wasn't the case in PL-19. Was I abusing PL-19 or
- did something break?
-
-
- Thanks,
-
-
- Dave
-
- ================================================================
- Dave Farnham
- Ball Aerospace
- Electro-Optical/Cryogenics Division "Why is my office so cold?"
- P.O. Box 1062
- Boulder, CO 80306 (303) 939-5515
- { farnham@spot.colorado.edu, farnham@handel.cs.colostate.edu }
-