in reply to Regular expression

Things clean up somwhat when you change the substitute to a match and know that the match returns the list of captured strings in list context:

use strict; use warnings; my $maxdate = "2006-06-05"; my ($m_year, $m_month, $d_day) = $maxdate =~ m/(^\d+)\-(\d+)-(\d+)/; print "year: $m_year, Month: $m_month, Day: $d_day\n";

Prints:

year: 2006, Month: 06, Day: 05

DWIM is Perl's answer to Gödel