ところが『先頭が数字で始まって途中で英字が混じる文字列』だと“syntax error”になってしまうの です。 # STR=1q2 # perl -le '$rev=reverse('$STR');print $rev' Bareword found where operator expected at -e line 1, near "1q2" (Missing operator before q2?) syntax error at -e line 1, near "1q2" Execution of -e aborted due to compilation errors.
『記号で始まって数字が混じり記号で終わる』についても“syntax error”になりました。 # STR=\\123\\ # echo $STR \123\ # perl -le '$rev=reverse('$STR');print $rev' Backslash found where operator expected at -e line 1, near "123\" (Missing operator before \?) syntax error at -e line 1, near "123\" Execution of -e aborted due to compilation errors.