in reply to Re: How to find barewords in perl code?
in thread How to find barewords in perl code?

I'd add a (?![,(]) to the end of that regex to exclude print functioncall() and print functionall, otherstuff.

Now let the bikeshedding and micro-optimizations begin!

Replies are listed 'Best First'.
Re^3: How to find barewords in perl code?
by JavaFan (Canon) on Jun 01, 2010 at 16:38 UTC
    Hmmm, forgot about function calls like that. For some reason, I assumed perl would warn. But even this is warning free:
    sub foo {shift} sub bar {1} print foo bar;
    and just prints 1.

    OTOH, in pre-5.6 days, when I was still using bare word file handles, I used all uppercase names, and I use all lowercase for subs, so /(?:print|...)\s+[A-Z]/ would have worked for my code.