Newbie question:Does Ruby have the structure of hash's array like Perl does?

A piece of Perl code as below:
#!/usr/bin/perl
$“=”,";
@b=qw/1 2 3/;
print @b;

will produce 1,2,3
if we erase $“=”,"; the result will be 123

it seem that $" in ruby represents sth else, because irb produces:

$"
=> [“irb.rb”, “e2mmap.rb”, “irb/init.rb”, “irb/context.rb”, “irb/extend-command.rb”, “irb/workspace.rb”, “irb/ruby-lex.rb”
, “irb/slex.rb”, “irb/ruby-token.rb”, “irb/input-method.rb”, “irb/locale.rb”, “tempfile.rb”, “delegate.rb”]

···

-----Original Message-----
From: Daniel Carrera [mailto:dcarrera@math.umd.edu]
Sent: Friday, March 28, 2003 4:16 PM
To: ruby-talk@ruby-lang.org
Subject: Re: Newbie question:Does Ruby have the structure of hash’s array like Perl does?

On Fri, Mar 28, 2003 at 05:09:09PM +0900, Weng Lei-QCH1840 wrote:

Thx!
Perl’s $" just like OFS in awk which is the output field separator,i.e.
that is printed between fields.

I’m not sure I understand. Can you give me an example of Perl code that
uses $"?

Regardless, its almost certain that Ruby’s equivalent is $".
AFAIK Ruby has carbon-copied nearly all of Perl’s special variables.

Please do show me what $" does. I’d like to know.

Daniel Carrera
Graduate Teaching Assistant. Math Dept.
University of Maryland. (301) 405-5137

depone: depone (di-POHN) verb tr., intr.
To declare under oath.

it seem that $" in ruby represents sth else, because irb produces:

$"
=> [“irb.rb”, “e2mmap.rb”, “irb/init.rb”, “irb/context.rb”,
“irb/extend-command.rb”, “irb/workspace.rb”, “irb/ruby-lex.rb”
, “irb/slex.rb”, “irb/ruby-token.rb”, “irb/input-method.rb”,
“irb/locale.rb”, “tempfile.rb”, “delegate.rb”]

Well, Brian just answered this question for us (thanks Brian).
Ruby uses $, whereas Perl uses $, or $" depending on whether you are
printing or joining an array.

···


Daniel Carrera
Graduate Teaching Assistant. Math Dept.
University of Maryland. (301) 405-5137

depone: depone (di-POHN) verb tr., intr.
To declare under oath.