This is because the parsing of your command-line string is done by the shell, not by perl. Different shells have slightly different rules for parsing the command line into argv. (More correctly, different shells have slightly different rules for how they expect the user to represent argv as a string.) It's just convention that
most shells use very similar rules for this. (Typically, separate parameters by spaces which are not enclosed in apostrophes or quotes, and which are not preceeded by a single backslash.)
Try this
perl -MData::Dumper -e "print Dumper(\@ARGV).qq{\n}" a b c 'a b c' a\
+b\ c "a b c" "'a b c'" *
under different shells and you may get slightly different results. It's really interesting to see the difference under windows/DOS command.com or cmd.exe shells, because the asterisk at the end of the line is just taken as a literal asterisk, whereas under unix shells, the asterisk will, instead, be replaced by the list of all files and directories matching the wildcard. In DOS/windows, programs that might operate on many files interpret the asterisk themselves, whereas in unix, the asterisk is transformed by the shell. For a really simple comparison, just try:
echo *
on both systems.
Anyways, for really detailed information on how your various shells parse the command line into argv, you should read that shell's documentation (man page).
------------
:Wq
Not an editor command: Wq
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.