Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
How can I do that, I hope I am been clear with this sample code to illustrate what I am trying to do.#!/usr/bin/perl -w use strict; my @code_reference = qw(aaaa qqqqq 7781q 09888 wetrt); foreach my $code(@code_reference) { my $place = "http://mylocation?param=" . $code ; my $data = XML::TreePP->new(); my $all_data = $data->parsehttp( GET => $place ); # This will return a different value for each "@code_reference". It co +uld be like: # "Value: AE" "Value: YY" "Value: C" "Value: P" "Value: PP" from my XM +L my $got_data=$all_data->{xml}->{code}->{"-data"}; # I have this hash, that I am trying to match lets say, if I got "Valu +e: AE", I want to # find the value in the hash the match "AE" and print. my %wind_dir = ( 'Loc A' => 'AA,A,AE,AB,BB,EA,C', 'Loc B' => 'TT,T,AE,B', 'Loc C' =>'PP,P,PA', 'Loc D' =>'YY, TT,P,OP,QA' ); # It should print: Loc A found AE # Loc B found AE
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Matching value in hash help!
by ikegami (Patriarch) on Sep 24, 2010 at 01:54 UTC | |
by Anonymous Monk on Sep 24, 2010 at 02:06 UTC | |
by Anonymous Monk on Sep 24, 2010 at 05:01 UTC | |
by ikegami (Patriarch) on Sep 24, 2010 at 14:16 UTC |