To expand upon previous answers, this is really an issue with MS, specifically cmd.exe, rather than Perl. Perl is passing
explorer $url, with
$url interpolated, to your shell. Lets say
$url = http://www.perlmonks.com/?node_id=816742. However, the shell misinterprets the
= and attempts to execute the command
explorer 816742 which fails to find the server 816742, naturally. The solution is to tell the shell to treat the whole argument as a string by wrapping the url in double quotes. Of course, then you can't use double quotes to wrap the string in Perl, so thank goodness Perl has so many delimiters:
Quote and Quote like Operators. Since you require interpolation,
qq is a good way to go, a la
system(qq{explorer "$url"}), which of course looks eerily similar to
ikegami and
Corion's solutions above.
Update: This might actually be explorer messing up the interpolation, since echo http://www.perlmonks.com/?node_id=816742 behaves as expected. Could not find any web resources, however, describing how explorer parses CLI arguments.
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.