Re: format output from Data::Dumper

2006-05-16 Thread Mr. Shawn H. Corey
On Mon, 2006-15-05 at 17:46 -0700, chen li wrote: > Hi all, > > I get data from Data::Dumper in an array format. > I just wonder if there is a means to format the > content in alphabetic order, something like "sort keys > or sort values". Data::Dumper can output hashes sorted by keys: $Data::D

RE: format output from Data::Dumper

2006-05-16 Thread chen li
Hi all, I use the following script to find out the methods available from a class of Bio::Seq. #!c:/Perl/bin/Perl.exe use warnings; use strict; use Bio::Seq; use Data::Dumper; use Class::Inspector; my $methods=Class::Inspector->methods('Bio::Seq', 'full','public'); print Data::Dumper->Dump([$m

Re: format output from Data::Dumper

2006-05-16 Thread Dr.Ruud
Jeff Pang schreef: > print Dumper @sort; I always go for the whole thing: print Data:Dumper->Dump( [EMAIL PROTECTED], [qw(*sort)] ); perl -MData::Dumper -e ' @s = sort( 1, 7, 3, 2, 5 ) ; print Data::Dumper->Dump( [ [EMAIL PROTECTED] ], [ qw(*s) ] ) ' @s = ( 1, 2, 3,

RE: format output from Data::Dumper

2006-05-15 Thread Jeff Pang
>Jeff Pang wrote: > >: my @original=(...); >: my @sort=sort {$a cmp $b} @original; >: print Dumper @sort; > >You might like the results better using an array reference. > >print Dumper [EMAIL PROTECTED]; > Sorry,my mistake.It's right really to use an array reference here. -- Jeff Pang NetEas

RE: format output from Data::Dumper

2006-05-15 Thread Charles K. Clarkson
Jeff Pang wrote: : my @original=(...); : my @sort=sort {$a cmp $b} @original; : print Dumper @sort; You might like the results better using an array reference. print Dumper [EMAIL PROTECTED]; Or you could avoid the extra array with the anonymous array constructor (or is it an operator?

Re: format output from Data::Dumper

2006-05-15 Thread Jeff Pang
> >I get data from Data::Dumper in an array format. >I just wonder if there is a means to format the >content in alphabetic order, something like "sort keys >or sort values". I would give you a simple way,you can sort the array and put the results into another array,then print this array to Dump