Hi
just for regular use i m working on small module written in perl for getting date in specified format like i have to specify date format and then seperator to seperate date i am 95% done. now i m sure explanation i gave is not good enough so i am putting output here :
C:\Documents and Settings\idc193577\Desktop>perl d.pl
Usage : d.pl <date_format> ['<seperator>']
Desc :
--> valid date_formats - dd # day of month ( 01 - 31 )
- ddd # 3 letter day name ( Mon Tue Wed ...)
- DD # full day name ( Monday )
- DDD # day of month and name in full ( 13 Friday )
- mm # month no ( 01 - 12 )
- mmm # 3 letter month name ( May Jun Jul ...)
- MM # full month name ( February )
- yy # last 2 digits of year ( 2009 -> 09 )
- yyyy # 4 digit year ( 2009 )
--> valid seperator - All Non Digits & Characters are valid.
*** P.S : Specify seperator within single quotes like ','
C:\Documents and Settings\idc193577\Desktop>perl d.pl ddmmyy
Input Format : ddmmyy | Seperator : [] | Output : [130209]
C:\Documents and Settings\idc193577\Desktop>perl d.pl ddd
Input Format : ddd | Seperator : [] | Output :[Fri]
C:\Documents and Settings\idc193577\Desktop>perl d.pl mmm
Input Format : mmm | Seperator : [] | Output [Feb]
C:\Documents and Settings\idc193577\Desktop>perl d.pl MM
Input Format : MM | Seperator : [] | Output : [February]
C:\Documents and Settings\idc193577\Desktop>perl d.pl yyyymmdd "/"
Input Format : yyyymmdd | Seperator : [/] | Output : [2009/02/13/]
now i can put anything as a seperator other than WORDS & NUMBERS this is where problem is coming look in above output last "/" in red is not required so i want to remove this and in code i am doing this as :
my $seperator = "$ARGV[1]" # which is "/"
my $result = "2009/02/13/" ; # hardcoded here
$result =~ s/${$seperator}$// ; # delete seperator which is at last but its not working i even tries escaping with \e${seperator} but did not work.
print $result ;
thanks