Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^10: What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff

by choroba (Cardinal)
on Oct 06, 2020 at 21:35 UTC ( [id://11122574]=note: print w/replies, xml ) Need Help??


in reply to Re^9: What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff
in thread What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff

The parsing of such an ambiguous expression depends on the prototypes of the subroutines/functions involved.
#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; sub single ($) { chr $_[0] } sub two ($$) { join "", map chr, @_ } say for split single 32, 'a b c'; say for split two(32, 32), 'a b c'; # This fails with "Too many arguments for main:two" say for split two(32, 32), 'a b c';

split can take more than one argument, so it greedily takes all it can.

> Unless this problem is fixed

It's not a problem, it's a documented behaviour.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
  • Comment on Re^10: What esteemed monks think about changes necessary/desirable in Perl 7 outside of OO staff
  • Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11122574]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-26 04:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found