in reply to Grabbing year and month from filename
I think you will like this better:2010-12-another-file.html 2010-7-this-is-an.html
Of course with Perl, there are always a number of ways to do this.2010-07-this-is-an.html 2010-12-another-file.html
Other ideas occured to me, but I believe that these are the two best alternatives.$month =~ s/^(\d)$/0$1/; # adds leading zero if there is just a single # digit- otherwise has no effect # *** I recommend this idea for # your application. **** $month = sprintf("%02d", $month); # re-assigns a new string value # to $month no matter what
|
|---|