# Backtrace.join($/) How is this code working

**URL:** <https://www.ruby-forum.com/t/backtrace-join-how-is-this-code-working/113213>\
**Category:** Rails\
**Created:** [August 28, 2007, 9:25pm UTC](https://www.ruby-forum.com/t/backtrace-join-how-is-this-code-working/113213 "2007-08-28T21:25:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dorelal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3da27b/32.png) [@dorelal](https://www.ruby-forum.com/u/dorelal)\
**Post date:** [August 28, 2007, 9:25pm UTC](https://www.ruby-forum.com/t/backtrace-join-how-is-this-code-working/113213/1 "2007-08-28T21:25:33Z")

</div>

I am amazed at how this code is working.

backtrace.join($/)

what does that dollar sign mean and what’s that slash before that. Full  
code  
at [http://snippets.dzone.com/posts/show/2427](http://snippets.dzone.com/posts/show/2427)

---

<div class="post-metadata">

**Author:** ![dorelal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3da27b/32.png) [@dorelal](https://www.ruby-forum.com/u/dorelal)\
**Post date:** [August 28, 2007, 10:39pm UTC](https://www.ruby-forum.com/t/backtrace-join-how-is-this-code-working/113213/2 "2007-08-28T22:39:46Z")

</div>

> I am amazed at how this code is working.
> 
> backtrace.join($/)
> 
> what does that dollar sign mean and what’s that slash before that. Full code  
> at [http://snippets.dzone.com/posts/show/2427](http://snippets.dzone.com/posts/show/2427)

backtrace is a method that returns…

Returns any backtrace associated with the exception. The backtrace is an  
array of strings, each containing either `filename:lineNo: in `method or `filename:lineNo.

join takes that array and joins it using $/ which I believe is the  
default  
line separator (usually defaults to \n, but maybe \r\n, or something  
else  
entirely if you’ve set it to that).

-philip
