944,123 Members | Top Members by Rank

Ad:
  • Perl Discussion Thread
  • Marked Solved
  • Views: 622
  • Perl RSS
Oct 20th, 2009
0

joining more than 1 array

Expand Post »
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.

Thanks
Aj
Perl Syntax (Toggle Plain Text)
  1. if ($lines =~m/Date/)
  2. {
  3. $lines=~s/\s+$//g;
  4. @aj2=split(/:/,$lines);
  5. push(@date,$aj2[1]);
  6. my($dd,$mm,$yy) = (split(/\s/,$date[0]))[1,2,3];
  7. push(@date1,"$dd");
  8. push(@month1, "$mm");
  9. push(@year1,"$yy");
  10. my($date2)= (join('-',@date1,@month1,@year1));
  11. print"$date2";
  12. }
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
ajay_p5 is offline Offline
29 posts
since Apr 2009
Oct 21st, 2009
0
Re: joining more than 1 array
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
Reputation Points: 13
Solved Threads: 1
Newbie Poster
vbharathi is offline Offline
8 posts
since Oct 2009
Oct 21st, 2009
0
Re: joining more than 1 array
Thanks..it works.
Reputation Points: 10
Solved Threads: 0
Light Poster
ajay_p5 is offline Offline
29 posts
since Apr 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Perl Forum Timeline: Basic parsing problem...Help plz
Next Thread in Perl Forum Timeline: Perl One Liner: Replace {(





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC