What does the “$” character mean in Ruby?

前端 未结 5 1638
深忆病人
深忆病人 2020-12-08 01:40

Been playing with Ruby on Rails for awhile and decided to take a look through the actual source. Grabbed the repo from GitHub and started looking around. Came across some co

5条回答
  •  暖寄归人
    2020-12-08 02:21

    I wanna note something weird about Ruby!

    $ does indeed mean load path. And ; means "end line". But!

    $; means field separator. Try running $;.to_s in your REPL and you'll see it return ",". That's not all! $ with other suffixes can mean many other things.

    Why? Well, Perl of course!

提交回复
热议问题