#!/usr/bin/perl -w use strict; my $VAR1 = [ [ 'a', 'W', 'interupt' ], [ 'b', 'R', 'interrupt' ], [ 'c', 'W', 'innterupt' ], [ 'd', 'W', 'intterupt' ] ]; print "Number of Questions: ", scalar @$VAR1, "\n"; #@$VAR1 produces a list of references to the arrays #The map selects the 2nd one of each array, index [1] #the grep in a scalar context counts them up print "Number right: ", scalar( grep{/r/i}map{@$_[1]}@$VAR1 ), "\n"; print "Number wrong: ", scalar( grep{/w/i}map{@$_[1]}@$VAR1 ), "\n"; #Maybe the question is which one is the "right" answer, a,b,c,d? print "\n"; print "correct answer is: ", map{@$_[1] =~ /r/i ? @$_[0]:()}@$VAR1; __END__ Number of Questions: 4 Number right: 1 Number wrong: 3 correct answer is: b Process completed successfully