Re: Accessing hash of arrays?

2008-10-03 Thread Matej Cepl
On 2008-10-03, 16:57 GMT, Paul Lalli wrote: > %targetedMessages is a hash > $targetedMessages{$tFolder} is an element of that hash, that happens > to be a reference to an array. Of course, silly me, thanks! Matěj -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EM

Re: Accessing hash of arrays?

2008-10-03 Thread Paul Lalli
On Oct 3, 10:03 am, [EMAIL PROTECTED] (Matej Cepl) wrote: > I have a script for archiving email messages on IMAP (whole code > is available athttp://mcepl.fedorapeople.org/tmp/archiveIMAP.pl). I go through > all messages in one source folder and put all of those which > I want to archive to hash in

Re: Accessing hash of arrays?

2008-10-03 Thread Mr. Shawn H. Corey
On Fri, 2008-10-03 at 16:03 +0200, Matej Cepl wrote: > I have a script for archiving email messages on IMAP (whole code > is available at > http://mcepl.fedorapeople.org/tmp/archiveIMAP.pl). I go through > all messages in one source folder and put all of those which > I want to archive to hash

Accessing hash of arrays?

2008-10-03 Thread Matej Cepl
I have a script for archiving email messages on IMAP (whole code is available at http://mcepl.fedorapeople.org/tmp/archiveIMAP.pl). I go through all messages in one source folder and put all of those which I want to archive to hash indexed by the target folder: ... $targetFolder = getTargetFol

Re: Accessing hash within an array of hashes

2007-08-07 Thread Paul Lalli
On Aug 7, 8:29 am, [EMAIL PROTECTED] (Mr. Shawn H. Corey) wrote: > Paul Lalli wrote: > >foreach my $key (keys %{$device_hash_ref}) > >{ > > print (" $key \t $device_hash{$key} \n"); > print (" $key \t $device_hash_ref->{$key} \n"); Whoops! Quite correct. Thanks f

Re: Accessing hash within an array of hashes

2007-08-07 Thread Mr. Shawn H. Corey
Paul Lalli wrote: I would have written the program like this: my $itemp = 1; foreach my $device_hash_ref (@devices_array_oH) { print " Details of device $itemp: "; print "\n\n"; foreach my $key (keys %{$device_hash_ref}) { print (" $key \t $device_hash{$key} \n");

Re: Accessing hash within an array of hashes

2007-08-07 Thread Paul Lalli
On Aug 7, 7:59 am, [EMAIL PROTECTED] (Charles J Gillan) wrote: > I have a problem with extracting an individual hash from an array of > hashes. I can't work out, or find elsewhere, the syntax for this. The syntax is found in perldoc perlref perldoc perlreftut perldoc perllol and perldoc perldsc

Accessing hash within an array of hashes

2007-08-07 Thread Charles J Gillan
I have a problem with extracting an individual hash from an array of hashes. I can't work out, or find elsewhere, the syntax for this. Code as follows: devices_array_oH is set up as array of hashes I want to loop over all hashes in the array and to print the key value pairs for each hash.

Re: Accessing hash

2007-05-29 Thread Brad Baxter
On May 28, 7:41 am, [EMAIL PROTECTED] (Jeevs) wrote: > On May 28, 11:35 am, [EMAIL PROTECTED] (Jeevs) wrote: > > > @hashi = @hash{qw (jeevan, sarika)}; > > print @hashi; > > > this gives me the values of keys jeevan and sarika.. how does this > > work ... It works because that's the syntax for a h

Re: Accessing hash

2007-05-28 Thread jeevs
On May 28, 11:35 am, [EMAIL PROTECTED] (Jeevs) wrote: > @hashi = @hash{qw (jeevan, sarika)}; > print @hashi; > > this gives me the values of keys jeevan and sarika.. how does this > work ... ok i got it ... and I think i was not clear in my query... I was expecting an hash slice to be %hash{qw(je

Re: Accessing hash

2007-05-28 Thread Rob Dixon
jeevs wrote: why is it that when i write my %hash = (jeevan=>'ingale', sarika=>'bere' ); my @arr = @hash{jeevan, sarika}; print @arr; prints ingale bere can someone explain me how an @sign is used and what exactly goes in the secongline of thecode. contrary when i try something like replac

Accessing hash

2007-05-28 Thread jeevs
@hashi = @hash{qw (jeevan, sarika)}; print @hashi; this gives me the values of keys jeevan and sarika.. how does this work ... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Accessing hash

2007-05-28 Thread Srinivas
Hi, @days{'Jan','Feb'} Hash slice containing ($days{'Jan'},$days{'Feb'}) -extracted from programmin perl 3rd edition -srini jeevs wrote: why is it that when i write my %hash = (jeevan=>'ingale', sarika=>'bere' ); my @arr = @hash{jeevan, sarika}; print @arr; prints ingale bere can someo

Accessing hash

2007-05-28 Thread jeevs
why is it that when i write my %hash = (jeevan=>'ingale', sarika=>'bere' ); my @arr = @hash{jeevan, sarika}; print @arr; prints ingale bere can someone explain me how an @sign is used and what exactly goes in the secongline of thecode. contrary when i try something like replacing the @ sign

Re: accessing hash value with ->

2005-01-14 Thread Robert Boone
Hello, Are you sure that %THE_COMMANDS( open => &dosomething ); is not %THE_COMMANDS( open => \&dosomething ); The \ in front of the & makes $THE_COMMAND{open} a code reference. And the way you dereference a code ref is with the -> operator. It's the same as if I did. my $open

accessing hash value with ->

2005-01-14 Thread radhika sambamurti
Hi, I am the "maintenance programmer" for this large chunk of code. My question is particular to this syntax: $THE_COMMANDS{$THE_COMMAND}->($THE_COMMAND); Where THE_COMMANDS is a hash %THE_COMMANDS( open => &dosomething ); Thus, $THE_COMMANDS{$THE_COMMAND} is nothing but &dosomething right? so wh