the_0ne has asked for the wisdom of the Perl Monks concerning the following question:
Sorry for the sloppy code, however, this comes from a very large script and just to figure this part out I wrote this code into a separate smaller script for debugging.$to = "foo\@bar.com"; $subject = "New CDs now"; $file_name = "AAAAA.txt"; $from = "that\@person.com"; $last_dir = "Spam"; $spam->{$to} = $to; $spam->{$to}->{$subject} = $subject; $spam->{$to}->{$subject}->{$file_name} = $file_name; $spam->{$to}->{$subject}->{$file_name}->{'path'} = $last_dir; $spam->{$to}->{$subject}->{$file_name}->{'from'} = $from; $to = "foo2\@bar.com"; $subject = "New CDs now"; $file_name = "BBBBB.txt"; $from = "that2\@person.com"; $last_dir = "Spam"; $spam->{$to} = $to; $spam->{$to}->{$subject} = $subject; $spam->{$to}->{$subject}->{$file_name} = $file_name; $spam->{$to}->{$subject}->{$file_name}->{'path'} = $last_dir; $spam->{$to}->{$subject}->{$file_name}->{'from'} = $from; print "\n"; for my $email_slice (sort keys %{$spam}) { print "email_slice - $email_slice\n"; for my $subject_slice (sort keys %{$email_slice}) { print "subject_slice - $subject_slice\n"; for my $fn_slice (sort keys %{$subject_slice}) { print "fn_slice - $fn_slice\n"; } } print "\n"; }
Notice how the fn_slice is duplicated? What I'm trying to get is...email_slice - foo2@bar.com subject_slice - New CDs now fn_slice - AAAAA.txt fn_slice - BBBBB.txt email_slice - foo@bar.com subject_slice - New CDs now fn_slice - AAAAA.txt fn_slice - BBBBB.txt
Notice how the AAAAA.txt and BBBBB.txt are separated by their respective email addresses? I can not imagine how the fn_slice is getting duplicated? I think it has something to do with the $subject since it's the same, however, the email_slice should take care of that and separate it.email_slice - foo2@bar.com subject_slice - New CDs now fn_slice - BBBBB.txt email_slice - foo@bar.com subject_slice - New CDs now fn_slice - AAAAA.txt
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why is part of slice duplicated?
by Abigail-II (Bishop) on May 28, 2002 at 17:18 UTC | |
by the_0ne (Pilgrim) on May 28, 2002 at 17:48 UTC | |
by Abigail-II (Bishop) on May 28, 2002 at 18:01 UTC | |
by the_0ne (Pilgrim) on May 28, 2002 at 18:13 UTC | |
by Abigail-II (Bishop) on May 28, 2002 at 18:37 UTC | |
| |
|
Re: Why is part of slice duplicated?
by danger (Priest) on May 28, 2002 at 17:16 UTC |