Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: database using associative has

by jwkrahn (Abbot)
on Jul 26, 2010 at 11:08 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-26 05:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found