Printing an array of hash refs
From: Tony N. (tnitzke_at_simpson.com)
Date: 09/22/04
- Next message: Paul Lalli: "Re: Printing an array of hash refs"
- Previous message: thundergnat: "Re: Perl script to clean up file -- Dont know if it can be done"
- Next in thread: Paul Lalli: "Re: Printing an array of hash refs"
- Reply: Paul Lalli: "Re: Printing an array of hash refs"
- Reply: Mark Clements: "Re: Printing an array of hash refs"
- Reply: John W. Krahn: "Re: Printing an array of hash refs"
- Reply: Jay Tilton: "Re: Printing an array of hash refs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 22 Sep 2004 08:35:33 -0700
I'm using the following code to print an array of hash refs. It seems
to me there should be a more concise way to do this. I don't like the
trailing \t or the extra line of code to get the \n. Any pointers
would be appreciated.
print "$_\t" for sort keys %{$rows[0]};
print "\n";
for my $row (@rows) {
print "$row->{$_}\t" for sort keys %{$row};
print "\n";
}
- Next message: Paul Lalli: "Re: Printing an array of hash refs"
- Previous message: thundergnat: "Re: Perl script to clean up file -- Dont know if it can be done"
- Next in thread: Paul Lalli: "Re: Printing an array of hash refs"
- Reply: Paul Lalli: "Re: Printing an array of hash refs"
- Reply: Mark Clements: "Re: Printing an array of hash refs"
- Reply: John W. Krahn: "Re: Printing an array of hash refs"
- Reply: Jay Tilton: "Re: Printing an array of hash refs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|