Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re: bug when using list element as a scalar reference ($$val) #119

Closed
p5pRT opened this issue Jun 27, 1999 · 6 comments
Closed

Re: bug when using list element as a scalar reference ($$val) #119

p5pRT opened this issue Jun 27, 1999 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 27, 1999

Migrated from rt.perl.org#923 (status was 'resolved')

Searchable as RT923$

@p5pRT
Copy link
Author

p5pRT commented Jun 27, 1999

From @gsar

You want ${$beta[0]}. See perlref.pod for why.

Sarathy
gsar@​activestate.com

@p5pRT
Copy link
Author

p5pRT commented Jun 27, 1999

From @gsar

A month ago, "Russell J. Romano" apparently wrote this and got no replies​:

# Both methods SHOULD (in my opinion) yield the same results

# METHOD 1 -
# proper function with scalar
$alpha = "Text before change in method 1";
$beta = "alpha";

# the following assignment really reads $"alpha" so it should assign a value
# to $alpha, and it does (as is apparent from the print that follows);
$$beta = "Text after change in method 1";
print "$alpha\n";

# METHOD 2 -
# improper function with array/list
$alpha = "Text before change in method 2";
$beta[0] = "alpha";

# the following assignment really reads $"alpha" so it should assign a value
# to $alpha, but it does not.
$$beta[0] = "Text after change in method 2";
print "$alpha\n";

You want ${$beta[0]}. See perlref.pod for why.

Sarathy
gsar@​activestate.com

4 similar comments
@p5pRT
Copy link
Author

p5pRT commented Jun 27, 1999

From @gsar

A month ago, "Russell J. Romano" apparently wrote this and got no replies​:

# Both methods SHOULD (in my opinion) yield the same results

# METHOD 1 -
# proper function with scalar
$alpha = "Text before change in method 1";
$beta = "alpha";

# the following assignment really reads $"alpha" so it should assign a value
# to $alpha, and it does (as is apparent from the print that follows);
$$beta = "Text after change in method 1";
print "$alpha\n";

# METHOD 2 -
# improper function with array/list
$alpha = "Text before change in method 2";
$beta[0] = "alpha";

# the following assignment really reads $"alpha" so it should assign a value
# to $alpha, but it does not.
$$beta[0] = "Text after change in method 2";
print "$alpha\n";

You want ${$beta[0]}. See perlref.pod for why.

Sarathy
gsar@​activestate.com

@p5pRT
Copy link
Author

p5pRT commented Jun 27, 1999

From @gsar

A month ago, "Russell J. Romano" apparently wrote this and got no replies​:

# Both methods SHOULD (in my opinion) yield the same results

# METHOD 1 -
# proper function with scalar
$alpha = "Text before change in method 1";
$beta = "alpha";

# the following assignment really reads $"alpha" so it should assign a value
# to $alpha, and it does (as is apparent from the print that follows);
$$beta = "Text after change in method 1";
print "$alpha\n";

# METHOD 2 -
# improper function with array/list
$alpha = "Text before change in method 2";
$beta[0] = "alpha";

# the following assignment really reads $"alpha" so it should assign a value
# to $alpha, but it does not.
$$beta[0] = "Text after change in method 2";
print "$alpha\n";

You want ${$beta[0]}. See perlref.pod for why.

Sarathy
gsar@​activestate.com

@p5pRT
Copy link
Author

p5pRT commented Jun 27, 1999

From @gsar

A month ago, "Russell J. Romano" apparently wrote this and got no replies​:

# Both methods SHOULD (in my opinion) yield the same results

# METHOD 1 -
# proper function with scalar
$alpha = "Text before change in method 1";
$beta = "alpha";

# the following assignment really reads $"alpha" so it should assign a value
# to $alpha, and it does (as is apparent from the print that follows);
$$beta = "Text after change in method 1";
print "$alpha\n";

# METHOD 2 -
# improper function with array/list
$alpha = "Text before change in method 2";
$beta[0] = "alpha";

# the following assignment really reads $"alpha" so it should assign a value
# to $alpha, but it does not.
$$beta[0] = "Text after change in method 2";
print "$alpha\n";

You want ${$beta[0]}. See perlref.pod for why.

Sarathy
gsar@​activestate.com

@p5pRT
Copy link
Author

p5pRT commented Jun 27, 1999

From @gsar

A month ago, "Russell J. Romano" apparently wrote this and got no replies​:

# Both methods SHOULD (in my opinion) yield the same results

# METHOD 1 -
# proper function with scalar
$alpha = "Text before change in method 1";
$beta = "alpha";

# the following assignment really reads $"alpha" so it should assign a value
# to $alpha, and it does (as is apparent from the print that follows);
$$beta = "Text after change in method 1";
print "$alpha\n";

# METHOD 2 -
# improper function with array/list
$alpha = "Text before change in method 2";
$beta[0] = "alpha";

# the following assignment really reads $"alpha" so it should assign a value
# to $alpha, but it does not.
$$beta[0] = "Text after change in method 2";
print "$alpha\n";

You want ${$beta[0]}. See perlref.pod for why.

Sarathy
gsar@​activestate.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant