From df7f21629079e538e9b0ce02c30fd4013bf38c17 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Fri, 16 Jan 2015 13:24:42 +0100 Subject: [PATCH] extract year filter into own sub --- html.pl | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/html.pl b/html.pl index 661423d..ee49703 100755 --- a/html.pl +++ b/html.pl @@ -405,8 +405,8 @@ sub author_html { } sub count_author_years { + my $years = shift; my ($authid) = @_; - my $years; foreach my $type ( keys %{ $authors->{$authid} } ) { foreach my $category ( keys %{ $authors->{$authid}->{$type} } ) { foreach my $biblionumber ( @{ $authors->{$authid}->{$type}->{$category} } ) { @@ -417,24 +417,18 @@ sub count_author_years { return $years; } -foreach my $row ( sort { $a->{full_name} cmp $b->{full_name} } @authors ) { - - my $first = substr( $row->{full_name}, 0, 1 ); - if ( $first ne $first_letter ) { - print $index qq{\n} if $first_letter; - $first_letter = $first; - print $index qq{

$first

\n\n} if $first_letter; + $first_letter = $first; + print $index qq{

$first

\n