Re: Printing an array of hash refs
From: Shawn Corey (shawn.corey_at_sympatico.ca)
Date: 09/22/04
- Next message: Paul Lalli: "Re: Printing an array of hash refs"
- Previous message: A. Sinan Unur: "Re: what module could easiely load all files to a @array from a specified folder(and subfolders)?"
- In reply to: Paul Lalli: "Re: Printing an array of hash refs"
- Next in thread: Paul Lalli: "Re: Printing an array of hash refs"
- Reply: Paul Lalli: "Re: Printing an array of hash refs"
- Reply: Ben Morrow: "Re: Printing an array of hash refs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 22 Sep 2004 14:08:13 -0400
Paul Lalli wrote:
> "Tony N." <tnitzke@simpson.com> wrote in message
> news:638483db.0409220735.49486c78@posting.google.com...
>
>>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.
>>for my $row (@rows) {
>> print "$row->{$_}\t" for sort keys %{$row};
>> print "\n";
>>}
>
>
> for my $row (@rows){
> print (join ("\t", sort keys %$row), "\n");
> }
>
> Paul Lalli
>
>
Isn't it?
print join( "\t", map { $row->{$_} } sort keys %$row ), "\n";
--- Shawn
- Next message: Paul Lalli: "Re: Printing an array of hash refs"
- Previous message: A. Sinan Unur: "Re: what module could easiely load all files to a @array from a specified folder(and subfolders)?"
- In reply to: Paul Lalli: "Re: Printing an array of hash refs"
- Next in thread: Paul Lalli: "Re: Printing an array of hash refs"
- Reply: Paul Lalli: "Re: Printing an array of hash refs"
- Reply: Ben Morrow: "Re: Printing an array of hash refs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|