in reply to Final date conversion happiness script
It doesn't make as much sense to have part of your conversion done in the main code and part done in a subroutine. Ditto for printing an error message in the main code or the successful formatting in a sub.# input: chomp(my $date = <>); # parse, return numeric year,month,day or empty list on error if (my ($y,$m,$d) = split_date($date)) { # print out in Month dd yy format print "Date is: ", format_date($y,$m,$d), "\n"; } else { print "invalid date: $date; please try again\n"; }
Update: make comment agree with code re: order of returned values; said parsing but meant conversion
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Final date conversion happiness script
by ctp (Beadle) on Jan 13, 2004 at 00:21 UTC |