in reply to Replacement for substr(Data::Dumper($x), 0, 4000)
mje,
Maybe I'm missing something, but couldn't you just copy the beginning of the array to a new array, and then call Dumper with that array reference. Don't know what you would do if you have a hash????
use strict ; use warnings; use Data::Dumper; use Devel::Size qw(total_size); # Create a lot of data my @newdata = (); $newdata[10_000] = ""; for my $i ( 0 .. 10_000 ) { $newdata[$i] = "New" x $i; } print "\n\t\@newdata Size: ",total_size(\@newdata), "\n\n"; ## 150 +_345_584 on my system my @shortarray = (); for my $k ( 0 .. $#newdata ) { $shortarray[$k] = $newdata[$k]; if ( total_size(\@shortarray) > 400 ) { last; } ## use Maxchar +s } print Dumper( \@shortarray ); 1;
That way you keep the essence of the script!
Good Luck!
"Well done is better than well said." - Benjamin Franklin
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Replacement for substr(Data::Dumper($x), 0, 4000)
by mje (Curate) on Jan 17, 2012 at 16:03 UTC | |
by flexvault (Monsignor) on Jan 17, 2012 at 16:16 UTC |