1 until $WAV->Status(); is perfectly-valid perl; it's using the Statement Modifiers syntax rather than the Compound Statements syntax. I didn't come up with most of that example: except for the for loop at the end, it's verbatim from the Win32::Sound documentation, specifically their EXAMPLE at the end: everything until the ############ was theirs, not mine, and should work. That line, specifically, is saying "loop doing nothing (1 is a noop, in that case) until $WAV->Status() is true"; that status will go true when the wav is done playing.

If it's not working, there's something wrong with your perl installation or Win32::Sound installation on your machine.

Are using Strawberry Perl, ActiveState, cygwin, or WSL (Windows Subsystem for Linux)? The full output of perl -V (that's a capital V) might help us debug what's going wrong, along with perl -MWin32::Sound -le "print $INC{'Win32/Sound.pm'}; print $Win32::Sound::VERSION".


In reply to Re^4: Playing wav files by pryrt
in thread Playing wav files by merrymonk

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.