Re: hash referrences and such

2007-03-30 Thread Chad Kemp
Mathew Snyder wrote: Chad Kemp wrote: Mathew, try to test every condition going INTO the hash (or hashes) before you actually assign a value to a key. as mentioned earlier, hashes must be key/value pairs. the key will auto-vivify if a key is "new" but only if a corresponding value accom

Re: hash referrences and such

2007-03-25 Thread Mathew Snyder
Chad Kemp wrote: > Mathew, > >try to test every condition going INTO the hash (or hashes) before > you actually assign a value to a key. as mentioned earlier, hashes must > be key/value pairs. the key will auto-vivify if a key is "new" but only > if a corresponding value accompanies it. whe

Re: hash referrences and such

2007-03-23 Thread Chad Kemp
Mathew, try to test every condition going INTO the hash (or hashes) before you actually assign a value to a key. as mentioned earlier, hashes must be key/value pairs. the key will auto-vivify if a key is "new" but only if a corresponding value accompanies it. when you assign values to a

Re: hash referrences and such

2007-03-22 Thread Mathew Snyder
Rob Dixon wrote: > It's very unclear what you're trying to do, and what your RT package > does. Let > me make some observations and guesses and you can tell me where I'm > right or > wrong. > > $tix is an iterator that will return a sequence of tickets through the Next > method. > > $ticket is a

Re: hash referrences and such

2007-03-21 Thread Chas Owens
On 3/21/07, Mathew Snyder <[EMAIL PROTECTED]> wrote: snip I'm under the impression that by assigning a single value to a hash it becomes the key with the value being null. snip Perl will let you do it, but it is not a good idea and almost certainly is not what you want to do. snip I did as yo

Re: hash referrences and such

2007-03-21 Thread Rob Dixon
Mathew Snyder wrote: Rob Dixon wrote: Mathew Snyder wrote: I have a problem printing out a hash. This is the script I'm working with: [snip old code] When I print the hash all I get is a reference. I can't seem to figure out how to get the actual contents. I've tried using \$, %$, %{

Re: hash referrences and such

2007-03-21 Thread Mathew Snyder
Chas Owens wrote: > On 3/21/07, Mathew Snyder <[EMAIL PROTECTED]> wrote: > snip >> my %customer = ${customer}; > snip > > Hashes cannot be created with only one value, they must always be in > pairs: key and value. If $customer has a type of HASH (you can put > > print ref($customer), "

Re: hash referrences and such

2007-03-21 Thread Chas Owens
On 3/21/07, Mathew Snyder <[EMAIL PROTECTED]> wrote: snip my %customer = ${customer}; snip Hashes cannot be created with only one value, they must always be in pairs: key and value. If $customer has a type of HASH (you can put print ref($customer), "\n"; in the code to check this) t

Re: hash referrences and such

2007-03-21 Thread Mathew Snyder
Rob Dixon wrote: > Mathew Snyder wrote: >> >> I have a problem printing out a hash. This is the script I'm working >> with: >> #!/usr/bin/perl >> >> use warnings; >> use strict; >> use lib '/usr/local/rt-3.6.3/lib'; >> use lib '/usr/local/rt-3.6.3/local/lib'; >> use RT; >> use RT::Tickets; >> >> R

Re: hash referrences and such

2007-03-20 Thread Mathew Snyder
Chas Owens wrote: > On 3/20/07, Mathew Snyder <[EMAIL PROTECTED]> wrote: > snip >> $timeworked = >> $env{$transaction->Creator}{$transaction->TimeTaken}; > snip > >> From this line you can see that %env is a HoH (hash of hashes). This > means that if you want to print it out you n

Re: hash referrences and such

2007-03-20 Thread Chas Owens
On 3/20/07, Mathew Snyder <[EMAIL PROTECTED]> wrote: snip $timeworked = $env{$transaction->Creator}{$transaction->TimeTaken}; snip From this line you can see that %env is a HoH (hash of hashes). This means that if you want to print it out you need two loops: one for the firs

Re: hash referrences and such

2007-03-20 Thread Mathew Snyder
Rob Dixon wrote: > Mathew Snyder wrote: >> >> I have a problem printing out a hash. This is the script I'm working >> with: >> #!/usr/bin/perl >> >> use warnings; >> use strict; >> use lib '/usr/local/rt-3.6.3/lib'; >> use lib '/usr/local/rt-3.6.3/local/lib'; >> use RT; >> use RT::Tickets; >> >> R

Re: hash referrences and such

2007-03-20 Thread Rob Dixon
Mathew Snyder wrote: I have a problem printing out a hash. This is the script I'm working with: #!/usr/bin/perl use warnings; use strict; use lib '/usr/local/rt-3.6.3/lib'; use lib '/usr/local/rt-3.6.3/local/lib'; use RT; use RT::Tickets; RT::LoadConfig(); RT::Init(); my $tix = new RT::Ticke

Re: hash referrences and such

2007-03-20 Thread Mathew Snyder
Jeff Pang wrote: >> Jeff Pang wrote: foreach my $key (keys %$env) { print $key . " -> " . $env{$key} . "\n"; } >>> Hello, >>> >>> For a quick look,the codes above may not work. >>> Since $env is a hash reference,so you can't say $e

Re: hash referrences and such

2007-03-20 Thread Jeff Pang
> >Jeff Pang wrote: >>>foreach my $key (keys %$env) { >>>print $key . " -> " . $env{$key} . "\n"; >>>} >> >> Hello, >> >> For a quick look,the codes above may not work. >> Since $env is a hash reference,so you can't say $env{$key} to access

Re: hash referrences and such

2007-03-20 Thread Mathew Snyder
Jeff Pang wrote: >>foreach my $key (keys %$env) { >>print $key . " -> " . $env{$key} . "\n"; >>} > > Hello, > > For a quick look,the codes above may not work. > Since $env is a hash reference,so you can't say $env{$key} to access the > hash

Re: hash referrences and such

2007-03-20 Thread Jeff Pang
>foreach my $key (keys %$env) { >print $key . " -> " . $env{$key} . "\n"; >} Hello, For a quick look,the codes above may not work. Since $env is a hash reference,so you can't say $env{$key} to access the hash's value. It may change to: pr

Re: hash referrences and such

2007-03-20 Thread Mathew Snyder
Also, I've read the *perldsc* perldoc and it didn't help undo my confusion. Mathew Mathew Snyder wrote: > I have a problem printing out a hash. This is the script I'm working with: > #!/usr/bin/perl > > use warnings; > use strict; > use lib '/usr/local/rt-3.6.3/lib'; > use lib '/usr/local/rt-3.

Re: hash referrences and such

2007-03-20 Thread Mathew Snyder
Also, I've read the *perldsc* perldoc and it didn't help undo my confusion. If we don't protect the freedom of speech, how will we know who the assholes are? http://theillien.blogspot.com Mathew Snyder wrote: > I have a problem printing out a hash. This is the script I'm working with: > #!/usr/