my$str= '4/25/10';
my$sr = join(' ',split (/\//,$str));
#my$s = sprintf '%3$d %2$d %1$d',$srt;
print$sr,"\n";
output:
4 25 10
But i want output like 2010-25-04
.Can any one suggest me how display the my desire output.Give me your suggestion
you answers will be appreciable.
Well, a braindead solution might be:
You could write something a little more self-documenting by highlighting what you expect to be year, month and day like so:
No need to do to DateTime for this. Time::Piece has been included with the Perl core distribution for years.
Gives:
You're not that far off.
Instead of splitting and joining in a single operation, you can keep individual variables to handle the data better:
Then you can format it in most any way you please, for example:
A few notes, though: