Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Replacement for substr(Data::Dumper($x), 0, 4000)

by mje (Deacon)
on Jan 17, 2012 at 16:03 UTC ( #948344=note: print w/ replies, xml ) Need Help??


in reply to Re: Replacement for substr(Data::Dumper($x), 0, 4000)
in thread Replacement for substr(Data::Dumper($x), 0, 4000)

The data is a basically

[[a,b],[c,d,e,...]]

where c, d and e etc could contain further array references usually no deeper than 3 but the spec for this data does not restrict it to 3. I can basically copy the first array ref and then take N of the c,d,e etc where hopefully the result when Dumped is not longer than 4K. However, it is unlikely I can get an N which provides just over 4K (reducing the work in Dumper) as c, d, e can contain other scalars of varying lengths. An ideal would be picking N which gave just over 4K when Dumped. However, although this could truncate the dumped string less than 4K when N was too small it is still a viable solution as we only need the data accurate up to the truncation and its only 4K because that is the column size - the more the better though.


Comment on Re^2: Replacement for substr(Data::Dumper($x), 0, 4000)
Download Code
Re^3: Replacement for substr(Data::Dumper($x), 0, 4000)
by flexvault (Vicar) on Jan 17, 2012 at 16:16 UTC

    mje,

      However, it is unlikely I can get an N which provides just over 4K...
    So pass Dumper 20KB or 100KB or whatever you think! It's still better than 16MB, and you control all the variables yourself!

    Thank you

    "Well done is better than well said." - Benjamin Franklin

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://948344]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (16)
As of 2014-04-16 20:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (434 votes), past polls