Thanks very much Steve
I was pulling my hair out on this one..
I interpreted the split/:+/ to be one or more ':' 
the key work being "or" 
I guess I really need to go back and review regexes

Jaime Hourihane
CDC-IXIS
212.891.1935

-----Original Message-----
From: Steve Mayer [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 10:49 AM
To: Hourihane, Jaime
Cc: [EMAIL PROTECTED]
Subject: Re: Printing values from hashes


Jaime,

  The problem is with the regular expression that you are using in the
  split function.

  When you say to use 1 or more ":" for the separator, you are causing
  the password field to be skipped (if it is empty as you will have two
  "::" together.

  If you change your regexp to just be 'split(/:/);' your program works
  correctly.

Steve

On Wed, Feb 13, 2002 at 10:42:00AM -0500, [EMAIL PROTECTED]
wrote:
> Hi I am new to hashes....
> Can somebody tell me why I can print $KEY but not $VALUE?
> 
> ======================================================
> #!/usr/local/bin 
> open(GROUP, "/etc/group") || die "Cannot open:$!\n";
> while(<GROUP>)  {
>       ($KEY,$gpass,$ggid,$VALUE) = split(/:+/);
>       $HASH{$KEY} = "$VALUE";
>       print "the users in Group $KEY are $VALUE\n";
> 
> 
> }
> =======================================================
> 
> Thanks in Advance
> 
> Jaime Hourihane
> CDC-IXIS
> 212.891.1935
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
=============================================================
Steve Mayer                             Oracle Corporation
Senior Member of Technical Staff        1211 SW 5th Ave.
Portland Development Center             Suite 900
[EMAIL PROTECTED]                Portland, OR 97204 
Phone:  503-525-3127
=============================================================

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to