Hi,
try this:
This outputs this:use strict; use warnings; my $year = 2013; # hard coded as not in the data my %months = (Jan => "01", Feb => "02", Mar => "03", Other => "...4 5 +6 7 8 9", Oct => 10, Nov => 11, Dec => 12); my $line = <DATA>; my ($date, $rest) = split /,/, $line; my ($mon, $day) = split / /, $date; my $month = $months{$mon}; my $new_date = "$month$day$year"; print $new_date, "\n"; __DATA__ Oct 31 08:30,/home/imanager/cppprod/AR_LM.csv Oct 31 07:32,/home/imanager/cppprod/AddressDevCHUBldgProj.csv Oct 31 08:06,/home/imanager/cppprod/AddressDevCHUBldgProj_LM.csv Oct 31 07:44,/home/imanager/cppprod/BalDue.csv Oct 31 08:07,/home/imanager/cppprod/BalDue_LM.csv Oct 31 07:50,/home/imanager/cppprod/Charges.csv Oct 31 08:10,/home/imanager/cppprod/Charges_LM.csv Oct 31 08:45,/home/imanager/cppprod/Dem_A_C.csv
I would suggest that you use the mkdir Perl internal function, rather that a system call. Something like this:$ perl dates.pl 10312013
mkdir $new_date or die "could not create directory $new_date $!";
In reply to Re: Convert date into day and month
by Laurent_R
in thread Convert date into day and month
by Ma
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |