in reply to Alternative values from array and print
use strict; use warnings; use List::Util qw(first); my %data = ( date => ['', '2009-01-01', '2009-01-02', ''], correct => ['Article_text1', 'Article_text2'], ); my $correction = first { length($_) } @{$data{correct}}; my $date = first { length($_) } @{$data{date}};
Please read perldsc and perlreftut which both explain data structures in Perl very nicely.
(Update: change link from perlref to perlreftut, which is more introductory).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Alternative values from array and print
by gem555 (Acolyte) on Jul 16, 2009 at 07:27 UTC | |
by moritz (Cardinal) on Jul 16, 2009 at 07:59 UTC | |
by gem555 (Acolyte) on Jul 16, 2009 at 09:46 UTC | |
by moritz (Cardinal) on Jul 16, 2009 at 10:57 UTC | |
|
Re^2: Alternative values from array and print
by gem555 (Acolyte) on Jul 16, 2009 at 07:23 UTC |