Skip to content

builtin::stringify does not document that its argument is in scalar context #22118

Open
@rwp0

Description

@rwp0

The documentation doesn't mention the effect of builtin::stringify function on arrays.

I expected it to act in a similar fashion to "" double quotes.

perl \
  -E 'my @array = ("one", "two"); say "@array"'

one two # <-- Delimited by space
perl \
  -M experimental=builtin \
  -E 'my @array = ("one", "two"); say stringify @array'

2 # <-- Acts as if in a non-string context (the same result if I replace the "stringify" with "scalar" function here)

Is it that the 2 numerical value is turned internally to a string value here?

Is this behavior normal and the results expected?

Do we need to mention the function's effect on arrays (and perhaps hashes too) in the documentation?

I was assuming that stringify is mostly equal to "" string context (with variable interpolation).

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions