From owner-freebsd-current Fri Jun 16 23:35:21 2000 Delivered-To: freebsd-current@freebsd.org Received: from smtp01.mrf.mail.rcn.net (smtp01.mrf.mail.rcn.net [207.172.4.60]) by hub.freebsd.org (Postfix) with ESMTP id 579D037B564 for ; Fri, 16 Jun 2000 23:35:18 -0700 (PDT) (envelope-from jacobson@pobox.com) Received: from 216-164-250-63.s571.tnt1.atn.pa.dialup.rcn.com ([216.164.250.63] helo=home.my.domain) by smtp01.mrf.mail.rcn.net with esmtp (Exim 2.12 #3) id 133CCI-0000nJ-00; Sat, 17 Jun 2000 02:35:15 -0400 Received: from home (joe@localhost [127.0.0.1]) by home.my.domain (8.9.3/8.9.3) with ESMTP id CAA03347; Sat, 17 Jun 2000 02:35:05 -0400 (EDT) (envelope-from joe@home.my.domain) Message-Id: <200006170635.CAA03347@home.my.domain> To: current@freebsd.org Subject: Re: GENERIC from today does not detect system console on my box Cc: peter@netplex.com.au, chris@calldei.com From: Joseph Jacobson Date: Sat, 17 Jun 2000 02:35:05 -0400 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >Chris Costello wrote: >> On Friday, June 16, 2000, Peter Wemm wrote: >> > Err.. how did you run it? 'perl < MYKERNEL'? If you run 'perl MYKERNEL' >> > it will generate nothing because I was kinda lame and didn't know how to do >> > argument parsing. :-] >> >> Couldn't have hurt to ask. >> >> while (defined($ARGV[0])) { >> # ... parse ... >> shift; >> } >> >> It'd work as perl script.pl arg1 arg2 ... or as ./script.pl >> arg1 arg2 ... (if +x). > >How about that and as a stdin pipe as well if no args are specified? while (<>) { # parse # ... } does this. It is a simple construct, but magical and generally does what you want. You can even modify the @ARGV array in the middle of the loop and have it work correctly. Perl is filled with these programming shortcuts, thus its beauty and strength. Joe To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message