Re: Duplicates list
Uri Guttman <[email protected]> Thu, 22 May 2025 14:46:39 -0400
| Newsgroups | gmane.comp.lang.perl.beginners |
|---|---|
| Organization | Which Clone Am I? |
| Message-ID | <[email protected]> |
On 5/22/25 14:39, [email protected] wrote: > Hello > > When I say (‘?’) x 3 > I get: (‘?’, ‘?’, ‘?’) > > I don’t know what happens. > Is this a new syntax for perl it is very old syntax (i think even back to perl4). the x operator duplicates the left side by the count on the right side. if the left is a scalar, the duplicates are merged into a single scalar. if the left side is in (), it is assumed to be a list and the duplicates are merged into a list. so what you see is a list of '?' duplicated into the list you got. you can read more about x in perldoc perlop. uri -- https://uriguttman.blogspot.com/ A Long Strange Trip A blog about computers, food, my life and silliness. -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/