Description of problem: We have a block of code that processes a hash with a date key in "01/Jul/2022" format. When we try to loop through the sorted keys with a sort procedure, we get an error indicating that the parameter passed to the convert_month routine is not a string. See the code below for a complete description. hits hash "01/Jul/2022" Title1 4 "03/Jul/2022" Title2 7 . . . foreach $date (sort sortdate keys %hits){ . . . } sub sortdate(){ #parse the date format DD/MMM/YYYY - i.e. 07/Feb/2019 # into sortable key YYYY##DD - i.e. 20190207 { substr($a,7,4) <=> substr($b,7,4) || Decode_Month(substr($a,3,3)) <=> Decode_Month(substr($b,3,3)) || substr($a,0,2) <=> substr($b,0,2) } } When we run this, we get the following error: Date::Calc::Decode_Month(): argument is not a string at ./xxx.pl line ###. Which points to the line with the Decode_Month(substr($a,3,3)) I can work around the error by forcing the result of the substr() call to be a string. Decode_Month("".substr($a,3,3)), but the type should have been set correctly without that, since substr returns the 3 character month string: Jan, Feb, ... I put in extra debug prints and all of the keys in the hits array are valid date strings with a valid 3 char month abbreviation. This code was ported over from Solaris and it is working fine there. Version-Release number of selected component (if applicable): Date::Calc (6.4) How reproducible: Every time Steps to Reproduce: 1. See above code 2. 3. Actual results: Error message: Date::Calc::Decode_Month(): argument is not a string at ./xxx.pl line ###. Expected results: process sorted list of hash elements Additional info:
Thank you for the report. However, if you want Red Hat to fix it, you have to file an official support request at <https://access.redhat.com/support/>. Bugzilla is not a support tool. Could you please provide a small script that can be used as a reproducer? I am not able to reproduce it with this script: https://jplesnik.fedorapeople.org/bugzillas/bz2131834.pl
OK, Let me review and I'll work it with the red hat folks. You can close.