home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!sun-barr!cs.utexas.edu!hermes.chpc.utexas.edu!news.utdallas.edu!convex!tchrist
- From: Tom Christiansen <tchrist@convex.COM>
- Subject: Re: or puzzlement
- Message-ID: <1992Jul23.194053.28653@news.eng.convex.com>
- Originator: tchrist@pixel.convex.com
- Sender: usenet@news.eng.convex.com (news access account)
- Nntp-Posting-Host: pixel.convex.com
- Reply-To: tchrist@convex.COM (Tom Christiansen)
- Organization: CONVEX Realtime Development, Colorado Springs, CO
- References: <BrtMFu.D0L@unx.sas.com> <MERLYN.92Jul23070028@romulus.reed.edu> <Brut2B.80J@unx.sas.com>
- Date: Thu, 23 Jul 1992 19:40:53 GMT
- X-Disclaimer: This message was written by a user at CONVEX Computer
- Corp. The opinions expressed are those of the user and
- not necessarily those of CONVEX.
- Lines: 43
-
- From the keyboard of kent@manzi.unx.sas.com (Paul Kent):
- :# how to generalize that comma trick to "next" ...
-
- Hey guys, there's nothing wrong with a few braces, or parens.
-
- :for $d ($d1,$d2)
- :{
- : opendir(D, $d) || warn "loop_comma: no $d", next;
- : print STDERR "loop_comma: $d must exist cuz we got this far\n";
- :}
-
- You want:
-
- for $d ($d1,$d2) {
- opendir(D, $d) || warn("loop_comma: no $d"), next;
- print STDERR "loop_comma: $d must exist cuz we got this far\n";
- }
-
- or
-
- for $d ($d1,$d2) {
- opendir(D, $d) || do { warn "loop_comma: no $d"; next; }
- print STDERR "loop_comma: $d must exist cuz we got this far\n";
- }
-
-
- or
-
- for $d ($d1,$d2) {
- unless (opendir(D, $d)) {
- warn "loop_comma: no $d";
- next;
- }
- print STDERR "loop_comma: $d must exist cuz we got this far\n";
- }
-
-
- --tom
- --
- Tom Christiansen tchrist@convex.com convex!tchrist
-
- #else /* !STDSTDIO */ /* The big, slow, and stupid way */
- --Larry Wall in str.c from the perl source code
-