Helllo all,
well I am trying to split a file on the basis of space first and then trying to join it with "-" but i am not able to do it, can sumone please suggest what should I do in order to do it.
I am attaching the required part of the whole code where I think the changes are required. It is just that i have a list of dates like this 30 jun 2008 and i want to change it in this format 30-jun-2008.


if ($lines =~m/Date/)
	   my($dd,$mm,$yy) =    (split(/\s/,$date[0]))[1,2,3];
           push(@month1, "$mm");
         my($date2)= (join('-',@date1,@month1,@year1)); 

Recommended Answers

All 2 Replies

1. if ($lines =~m/Date/) {
2 $lines=~s/\s+$//g;
3. @aj2=split(/:/,$lines);
4. push(@date,$aj2[1]);
5. my($dd,$mm,$yy) = (split(/\s/,$date[0]))[1,2,3];
6. my($date2)= (join('-',$dd,$mm,$yy));
7. print $date2;
try this....it will work

Thanks..it works.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.