Re: Snippet explanation please

2007-07-05 Thread Jenda Krynicky
From: Monty <[EMAIL PROTECTED]> > Thanks for all the replies, both in this group and in separate e- > mails. > > Things have been cleared up. My major misunderstanding was in the > fact that $1, $2, etc. can exist outside the RegEx. I previously > thought they had to be confined to the expressio

Re: Snippet explanation please

2007-07-05 Thread Monty
Thanks for all the replies, both in this group and in separate e- mails. Things have been cleared up. My major misunderstanding was in the fact that $1, $2, etc. can exist outside the RegEx. I previously thought they had to be confined to the expression itself. Through some experimenting I find

Re: Snippet explanation please

2007-07-05 Thread John W. Krahn
Paul Lalli wrote: On Jul 5, 10:49 am, [EMAIL PROTECTED] (Monty) wrote: next unless /^(\S+)/; $who{$1}++; } It's the 'next' line I'm unclear on. I know that results: parse the first field from each output line of the 'who' command, but I'm wondering why this might have been done in thi

Re: Snippet explanation please

2007-07-05 Thread Paul Lalli
On Jul 5, 10:49 am, [EMAIL PROTECTED] (Monty) wrote: > I'm reading "Network Programming with Perl" by Lincoln Stein, and I've > come across a snippet of code I'mnot quite following: > > open (WHOFH, "who |") or die "Can't open who: $!"; > > While () { Please configure your mail/newsreader not to r

Re: Snippet explanation please

2007-07-05 Thread Tom Phoenix
On 7/5/07, Monty <[EMAIL PROTECTED]> wrote: I'm reading "Network Programming with Perl" by Lincoln Stein, and I've come across a snippet of code I'mnot quite following: open (WHOFH, "who |") or die "Can't open who: $!"; While () { next unless /^(\S+)/; $who{$1}++; } That should be "w

Re: Snippet explanation please

2007-07-05 Thread Jenda Krynicky
From: Monty <[EMAIL PROTECTED]> > I'm reading "Network Programming with Perl" by Lincoln Stein, and I've > come across a snippet of code I'mnot quite following: > > open (WHOFH, "who |") or die "Can't open who: $!"; > > While () { > next unless /^(\S+)/; > $who{$1}++; > } > > It's the 'n

Re: Snippet explanation please

2007-07-05 Thread John W. Krahn
Monty wrote: I'm reading "Network Programming with Perl" by Lincoln Stein, and I've come across a snippet of code I'mnot quite following: open (WHOFH, "who |") or die "Can't open who: $!"; While () { 'While' is an error. What the code probably said was 'while' (Perl is case sensitive.) Th