Ok, this is called debugging and it will probably also help you in the future.
When a pattern matching or a comparison or a grep does not work like you think it should, you can simply print the contents of the variable(s).
local $Data::Dumper::Useqq = 1; # show things like newlines, tabs as "
print Dumper $input_A;
print Dumper \@test_input_array;
I suspect the elements in @test_input_array have spaces where you don't expect them (you split on a single comma and forget about the spaces).