I have been recently working on some code that processes data returned from a third party function to generate reports. I wanted to make sure that the data I have been reciving is correct and so have used Data::Dumper to print it so I can check. My problem however is that whilst running the following call to show me the whole object returned:-
print Data::Dumper->Dump([$sb]);
produces
$VAR1 = bless( [
'100',
[
[
'2593140',
'2766860',
'0',
undef,
undef,
undef,
undef,
'0UI38923424239K',
'2002-01-10 09:16:50',
'1500',
'None Given',
'£',
'GBP'
],
[
'2513902',
'2766861',
'1',
undef,
undef,
undef,
undef,
'LKJS3892342423Y5S',
'2002-01-10 09:16:54',
'1500',
'None Given',
'£',
'GBP'
],
[
'2574165',
'2766862',
'0',
undef,
undef,
undef,
undef,
'0ASJH2782121S',
'2002-01-10 09:16:57',
'1500',
'None Given',
'£',
'GBP'
],
........etc
when I try and just display the subset of that data (ie just the bit that actualy interests me :-
print Data::Dumper->Dump($sb->[1]);
all I get is
$VAR1 = [
'2593140',
'2766860',
'0',
undef,
undef,
undef,
undef,
'0UI38923424239K',
'2002-01-10 09:16:50',
'1500',
'None Given',
'£',
'GBP'
];
ie I dont seem to be able to access all the rest.
On top of that if I go
print Data::Dumper->Dump($sb->[1]->[$anumber]);
where $anumber is 1,2,3,4 etc I get the first element of each of the successive arrays from the original
Its not been a huge problem as dumping the entire object showed me that all the data was indeed there. But I would like to know why Data::Dumper didn't produce the results I was expecting. Any ideas?
---If it doesn't fit use a bigger hammer
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.