The first case is different from the others. Using warnings helps there:
$ perl -wle 'print <x>'
Name "main::x" used only once: possible typo at -e line 1.
readline() on unopened filehandle x at -e line 1.
Using B::Deparse on the other three tells us that they use the same program structure:
$ perl -MO=Deparse -le 'print <x*>'
BEGIN { $/ = "\n"; $\ = "\n"; }
use File::Glob ();
print glob('x*');
-e syntax OK
Using that snippet for your first case as well gives:
$ perl -MFile::Glob -wle 'print glob "x"'
x
So glob treats the two first cases differently. The documentation says that it implements csh semantics. I guess that's why.
-
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.
|