Re: HoH problem representing a data structure.

2008-06-08 Thread Rob Dixon
Rodrick Brown wrote: > On Sun, Jun 8, 2008 at 10:37 AM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> > wrote: > >> Rodrick Brown wrote: >> >>> #!/usr/bin/perl -w >>> >> The -w switch is redundant, since you have "use warnings;". >> >> use strict; >>> use warnings; >>> use Data::Dumper; >>> my $file = '

Re: HoH problem representing a data structure.

2008-06-08 Thread Gunnar Hjalmarsson
Rodrick Brown wrote: On Sun, Jun 8, 2008 at 10:37 AM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: push @{ $hash->{$homeDir} }, $user; Yes please explain how exactly that line works? I know @{} dereferences an array so it looks like your pushing each user into an anonymous array. Yes, t

Re: HoH problem representing a data structure.

2008-06-08 Thread Rodrick Brown
On Sun, Jun 8, 2008 at 10:37 AM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote: > Rodrick Brown wrote: > >> >> #!/usr/bin/perl -w >> > > The -w switch is redundant, since you have "use warnings;". > > use strict; >> use warnings; >> use Data::Dumper; >> my $file = '/etc/passwd'; >> my $hash; >> my

Re: HoH problem representing a data structure.

2008-06-08 Thread Gunnar Hjalmarsson
Rodrick Brown wrote: #!/usr/bin/perl -w The -w switch is redundant, since you have "use warnings;". use strict; use warnings; use Data::Dumper; my $file = '/etc/passwd'; my $hash; my ($user, $homeDir); my $count=0; Why did you declare that variable? open(my $fh, "<", $file) or die("Fatal

Re: HoH problem representing a data structure.

2008-06-08 Thread Rodrick Brown
I want each Hash element to point to an array or list of users that share the same home dir instead of another hash. ie. $VAR1 = { '/var/imap' => { '_cyrus' }, '/var/empty' => { '_spotlight'

Re: HoH problem representing a data structure.

2008-06-08 Thread Aruna Goke
Rodrick Brown wrote: I'm trying to fully understand references so I created a data structure to stores the output of users on my system who share home dirs. I use a HoH to represent this data set but its not working as expected. Conceptually I can visualize how the data should look but I cant get

Re: HoH problem representing a data structure.

2008-06-08 Thread Aruna Goke
Rodrick Brown wrote: I'm trying to fully understand references so I created a data structure to stores the output of users on my system who share home dirs. I use a HoH to represent this data set but its not working as expected. Conceptually I can visualize how the data should look but I cant get

Re: HoH problem representing a data structure.

2008-06-08 Thread John W. Krahn
Rodrick Brown wrote: I'm trying to fully understand references so I created a data structure to stores the output of users on my system who share home dirs. I use a HoH to represent this data set but its not working as expected. Conceptually I can visualize how the data should look Perhaps if y