# Beginner Question - ?/

**URL:** <https://rubytalk.org/t/beginner-question/26712>\
**Category:** ruby-talk\
**Created:** [18 April 2006 01:47 UTC](https://rubytalk.org/t/beginner-question/26712 "2006-04-18T01:47:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bihal](https://avatars.discourse-cdn.com/v4/letter/b/7c8e57/32.png) [@Bihal](https://rubytalk.org/u/Bihal)\
**Post date:** [18 April 2006 01:47 UTC](https://rubytalk.org/t/beginner-question/26712/1 "2006-04-18T01:47:39Z")

</div>

Hey guys

Found a strange piece of code I haven't run into before.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def redirect\_to\_directory\_uri(req, res)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if req.path[-1] != ?/  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;location = req.path + "/"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if req.query\_string && req.query\_string.size \> 0  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;location \<\< "?" \<\< req.query\_string  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;res.set\_redirect(HTTPStatus::MovedPermanently, location)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end

It's the "?/" on the second line that I don't understand. The only other  
place I can find this is in one of the required files (used in the same  
way) or at the end of a regular expression, but this is clearly not. I  
have no idea what it is. Can anybody help?

Bihal

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Ara.T.Howard6](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Ara.T.Howard6](https://rubytalk.org/u/Ara.T.Howard6)\
**Post date:** [18 April 2006 02:18 UTC](https://rubytalk.org/t/beginner-question/26712/2 "2006-04-18T02:18:11Z")

</div>

harp:~ \> ruby -e' [?a, ?b, ?c].each{|charcode| p charcode} '  
&nbsp;&nbsp;&nbsp;97  
&nbsp;&nbsp;&nbsp;98  
&nbsp;&nbsp;&nbsp;99

-a

> **···**
>
> On Tue, 18 Apr 2006, Bihal wrote:
> 
> > Hey guys
> > 
> > Found a strange piece of code I haven't run into before.
> > 
> > &nbsp;&nbsp;&nbsp;&nbsp;def redirect\_to\_directory\_uri(req, res)  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if req.path[-1] != ?/  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;location = req.path + "/"  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if req.query\_string && req.query\_string.size \> 0  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;location \<\< "?" \<\< req.query\_string  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;res.set\_redirect(HTTPStatus::MovedPermanently, location)  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end
> > 
> > It's the "?/" on the second line that I don't understand. The only other  
> > place I can find this is in one of the required files (used in the same  
> > way) or at the end of a regular expression, but this is clearly not. I  
> > have no idea what it is. Can anybody help?
> > 
> > Bihal
> > 
> > --  
> > Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
> 
> --  
> be kind whenever possible... it is always possible.  
> - h.h. the 14th dali lama

---

<div class="post-metadata">

**Author:** ![Logan\_Capaldo](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@Logan\_Capaldo](https://rubytalk.org/u/Logan_Capaldo)\
**Post date:** [18 April 2006 02:23 UTC](https://rubytalk.org/t/beginner-question/26712/3 "2006-04-18T02:23:40Z")

</div>

And just in case this was a little cryptic, ?SOME\_CHARACTER is the ruby equivalent of C's 'SOME\_CHARACTER' or Lisp's #\SOME\_CHARACTER

> **···**
>
> On Apr 17, 2006, at 10:18 PM, ara.t.howard@noaa.gov wrote:
> 
> > &nbsp;&nbsp;harp:~ \> ruby -e' [?a, ?b, ?c].each{|charcode| p charcode} '  
> > &nbsp;&nbsp;97  
> > &nbsp;&nbsp;98  
> > &nbsp;&nbsp;99
> > 
> > -a  
> > --

---

<div class="post-metadata">

**Author:** ![Bihal](https://avatars.discourse-cdn.com/v4/letter/b/7c8e57/32.png) [@Bihal](https://rubytalk.org/u/Bihal)\
**Post date:** [18 April 2006 04:02 UTC](https://rubytalk.org/t/beginner-question/26712/4 "2006-04-18T04:02:29Z")

</div>

Logan Capaldo wrote:

> **···**
>
> > On Apr 17, 2006, at 10:18 PM, ara.t.howard@noaa.gov wrote:
> > 
> > > &nbsp;&nbsp;harp:~ \> ruby -e' [?a, ?b, ?c].each{|charcode| p charcode} '  
> > > &nbsp;&nbsp;97  
> > > &nbsp;&nbsp;98  
> > > &nbsp;&nbsp;99
> > > 
> > > -a  
> > > --
> > 
> > And just in case this was a little cryptic, ?SOME\_CHARACTER is the  
> > ruby equivalent of C's 'SOME\_CHARACTER' or Lisp's #\SOME\_CHARACTER
> 
> Thanks guys!
> 
> Bihal
> 
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
