Sorry all, for not being too descriptive..
The closest I want to accomplish is the this example u shown :
my %map = (
typeA => sub { $_[0]->{key1}[3]{key2} },
typeB => sub { $_[0]->{key3} },
typeC => sub { $_[0]->[1]{key4} },
# ...
);
i.e. in my concentrate case I was looping over a result of
SOAP::Lite. Which depending on the type of the object places the 'price' in different places f.e.
$$obj{cost} <--type1
$$obj{priceList}{price} <--type2
$$obj{priceList}{price}{value} <--type3
...etc..
So instead of doing alot of if-typeX, I thought it will be good if I can store the access-path in some way and do a simple hash lookup.
Is it more clear now ;)
(Something like XPath on LoL)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.