#!/usr/bin/perl use warnings; use strict; use Date::Manip qw(ParseDate); my @years = (2004..2008); sub find_year { my ($date) = @_; for my $year (@years) { my $date = ParseDate("$date $year"); return $year if $date; } return undef; } my @dates = ("Thu Sep 18", "Wed Sep 7"); for (@dates) { my $year = find_year($_); print "$_ => " . (defined($year) ? $year : "not found" ) . "\n"; }
In reply to Re: Question, New To Hashes
by pjotrik
in thread Question, New To Hashes
by walkingthecow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |