in reply to accessing data in hash
G'day ccfc1986,
Welcome to the monastery.
"I have a hash (i believe it to be a hash) ..."
That's a fundamental concept that you should understand. Start by reading "Perl introduction for beginners".
Your data contains references ([...] and {...}) which you'll need to handle. "Perl references short introduction" should provide sufficient background for what you'll need here.
You're dealing with a complex data structure. Read "Perl data structures intro" to understand this part of your code.
By now you should have a good idea about you've been doing wrong. Simple typos in your code may still result in buggy code (i.e. invalid logic but still valid syntax) which aren't immediately obvious. As you would have read from that first link I provided, let Perl find these problems for you, by adding these two lines to the top of all your scripts:
use strict; use wanings;
You haven't shown sufficient code, output, error/warning messages, etc. to know what a correct solution would be. The guidelines in "How do I post a question effectively?" describe what information to provide such that we can more easily help you.
If you really are dealing with a hash, then the code you'll need to meet your described requirements would be something like this:
for (@{$your_hash{data}}) { if ($_->{ID} == $current_job_id) { # Do your checks on $_->{State} here last; } }
As you can see, that looks nothing like the code you posted. Given the lack of information I've already mentioned, that's my best guess.
-- Ken
|
|---|