As noted, I find the oddity in that it warns about exactly one space - althought it doesn't do that always:
perl -wle 'print ("foo")' # Warning
perl -wle 'print ("foo");' # No warning
perl -wle 'print (")");' # Warning
perl -wle 'print ("\x29");' # No warning
Now, I know why it's happening (I've studied the source), and I also know what the intent is, but that's beside the point.
brian asked about oddities, and I do find this an oddity.
But the single space is not the only thing that I find an oddity. I also find it odd (as in, irregular, different that you would expect based on how similar constructs are handled - you know, what brian was asking for - so spare me the explainations on why it is this way - I know already) that is only has these warnings for print and I think one other function. For other functions, it doesn't warn.
$ perl -wle 'print ("foo") . "bar"'
print (...) interpreted as function at -e line 1.
Useless use of concatenation (.) or string in void context at -e line
+1.
foo
$ perl -wle 'my $s = length ("foo") . "bar"'
Why warn only with print and a single space, but not with
length or other functions? Or other amounts of whitespace? That I find an oddity.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.