Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: database using associative has

by jwkrahn (Monsignor)
on Jul 26, 2010 at 11:08 UTC ( #851354=note: print w/replies, xml ) Need Help??


in reply to database using associative has

You may need something like this UNTESTED:

#!/usr/bin/perl use warnings; use strict; my @header = qw( English History Maths Science Geography ); my %studentlist; while ( <> ) { my ( $name, @subinfo ) = split; @{ $studentlist{ $name } }{ @header } = @subinfo; } foreach my $student ( keys %studentlist ) { print " $student fails in :", join( ' ', grep $studentlist{ $stude +nt }{ $_ } <= 50, @header ), "\n"; }

Replies are listed 'Best First'.
Re^2: database using associative has
by changma_ha (Sexton) on Jul 27, 2010 at 08:52 UTC

    Thanks jwkrahm .... can u plz explain the following lines

    @{ $studentlist{ $name } }{ @header } = @subinfo; and print " $student fails in :", join( ' ', grep $studentlist{ $student } +{ $_ } <= 50, @header ), "\n"; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2022-11-26 22:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?