You can see this in action by renaming helloworld.exe to helloworld. You will not be able to run it from the Command Prompt, but Perl can still run it with system("helloworld"). If you rename it to helloworld.com, it will still work even though the extension is wrong, because the Kernel does not use the file's name.

Interesting. However, if you rename it helloword.txt and double-click it, Explorer will try to open it in Notepad (by default). So Explorer is still using the old filename mechanism to determine whether it's executable or should open with another program such as Notepad or Perl. But once it determines that it's directly executable (exe, com, or whatever), it then uses another mechanism, different from what Win9x uses. This is actually not surprising, but it's interesting. It's also interesting that Perl's system bypasses the former mechanism, assumes the thing's executable, and jumps straight to the execution system call. One supposes this means that using system in a Perl script to call up a document will not launch the associated application. (One also supposes there's a Win32:: module that will allow you to do that, however, if it's what you want to do. I'm guessing, though.)

It's also useful in certain edge cases. For example, you can rename an .sxw file to .zip, open it as a Compressed Folder, make a minor change to the XML (e.g., removing an unwanted paragraph, which the OOo UI in certain cases won't let you do, e.g., the only paragraph before or after a table), rename it back, doubleclick it, and it opens in OOo again. On *nix you'd just use the command-line zip/unzip to do this, but that's more cumbersome on Windows, so the ability to manipulate the associations is a nice compensation.

Out of curiousity, what if you rename an EXE with a .bat extension and double-click it?


"In adjectives, with the addition of inflectional endings, a changeable long vowel (Qamets or Tsere) in an open, propretonic syllable will reduce to Vocal Shewa. This type of change occurs when the open, pretonic syllable of the masculine singular adjective becomes propretonic with the addition of inflectional endings."  — Pratico & Van Pelt, BBHG, p68

In reply to Re: Perl Directive by jonadab
in thread Perl Directive by Echo Kilo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.