in reply to Bash vs Perl. Why doesn't work...?
Thank you ree for your help. I found my answer in newline :)
I updated the code, you can check Update #2 for the updated part. After that line, perl code works too. Thanks again.