Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^6: Feature Idea: qr//e

by LanX (Cardinal)
on Jan 20, 2017 at 12:38 UTC ( #1179995=note: print w/replies, xml ) Need Help??


in reply to Re^5: Feature Idea: qr//e
in thread Feature Idea: qr//e (updated with solutions)

Most probably the parser gets confused because m and s are builtin commands on their own and can't be bare words.

In other words

sub m {} should be illegal.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

Replies are listed 'Best First'.
Re^7: Feature Idea: qr//e
by huck (Parson) on Jan 20, 2017 at 13:11 UTC
      Well it's a parsing problem, if you manage to enter a subroutine named s into the stash you can certainly call it with &s (which is not a bare word anymore)

      Can't test at the moment, and Perl's parser is known to be complicated. :)

      (I remember that CGI renamed tr to TR for this reason)

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

        > if you manage to enter a subroutine named s into the stash you can certainly call it with &s

        to illustrate what I meant, *s and &s are not "bare" because of the sigils.

        But a bare word s is supposed to start a s/// resp. s()() or s{}{} or ... depending on whatever character follows (even with empty space in between)

        This makes parsing particularly difficult.

        use strict; use warnings; *s = sub { warn "s called" }; &s(); # --- not working # sub s { # warn "s called" # } # --- neither # s();
        s called at c:/tmp/pm/s_sub.pl line 11.

        This problem should apply for all perlop#Quote-and-Quote-like-Operators .

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2021-03-02 08:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (41 votes). Check out past polls.

    Notices?