Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: print format

by ctilmes (Vicar)
on Apr 22, 2003 at 16:03 UTC ( [id://252302]=note: print w/replies, xml ) Need Help??


in reply to print format

I stuck your test data into a structure purely for an example. Concentrate on the loops and the format/write. Fill in your own logic for setting $accession, $item1 and $item2.
my %accession = ( '1223455' => [ { item1 => 'abdkek', item2 => 'akdjeg' }, { item1 => 'ksitjls', item2 => 'jsoirl' }, { item1 => 'lsiet', item2 => 'oliut' } ], '2874824' => [ { item1 => 'lsiugl', item2 => 'potpsgj' }, { item1 => 'postis', item2 => 'potltids' } ], '1375080' => [ ], '0875709' => [ { item1 => 'llskgjo', item2 => 'ooiwuto' } ], '9876653' => [ { item1 => 'lsgjgdlk', item2 => 'ldkgjldj' } ] ); my ($accession, $item1, $item2); foreach $accession (sort keys %accession) { #.... if (not scalar @{$accession{$accession}}) # no items { $item1 = $item2 = ''; write; next; } foreach my $itemset (@{$accession{$accession}}) { # Do whatever you want to set $item1, $item2 $item1 = $itemset->{item1}; $item2 = $itemset->{item2}; write; $accession = ''; # blank for subsequent prints } } format STDOUT_TOP = Accession item1 item2 . format STDOUT = @<<<<<<<<<<<<< @<<<<<<<<<< @<<<<<<<<< $accession, $item1, $item2 .

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-26 04:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found