rovf has asked for the wisdom of the Perl Monks concerning the following question:
yields Search pattern not terminated or ternary operator parsed as search pattern. The error goes away if I call the function as func(). My question: Why does a question mark after a bareword parse as search pattern? Is it just to comply with those internal functions such as grep or split, which accept a regexp as first argument, or is there a deeper reason for this seemingly oddity?use strict; use warnings; sub func {} func ? '-N ' : '';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why do I need parentheses here?
by ikegami (Patriarch) on May 27, 2009 at 13:19 UTC | |
by rovf (Priest) on May 27, 2009 at 13:57 UTC | |
by ikegami (Patriarch) on May 27, 2009 at 14:17 UTC | |
by rovf (Priest) on May 27, 2009 at 14:57 UTC | |
by ikegami (Patriarch) on May 27, 2009 at 15:01 UTC | |
| |
by Anonymous Monk on May 27, 2009 at 14:01 UTC | |
|
Re: Why do I need parentheses here?
by jettero (Monsignor) on May 27, 2009 at 13:14 UTC |