I am trying to use pack to return the indices of a character array where a certain letter occurs. I am using:
results = pack([(az,az=1,10)],[((text(i) == testarray(1)),i=1,10)])
where results is an integer array and text and testarray are arrays of chars.
The code compiles correctly and appears to run but results is always empty. Can anyone assist me? I am an experienced Fortran programmer but have no experience using the pack function.
I expected that results = pack([(az,az=1,c3)],[((text(i) == testarray(1)),i=1,c3)]) would use the implied do loop against the equality test to create a temp logical mask which would then be used to select for the array created by the az loop and give me the indices where the logical mask was true.
I am using GNU Fortran 12.1.0