15.7.1. Problem You want to sound an alarm on the user's terminal.
15.7.2. Solution Print the "\a" character to sound a bell: print "\aWake up!\n"; Or use the "vb" terminal capability to show a visual bell: use Term::Cap; $OSPEED = 9600; eval { require POSIX; my $termios = POSIX::Termios->new( ); $termios->getattr; $OSPEED = $termios->getospeed; }; $terminal = Term::Cap->Tgetent({OSPEED=>$OSPEED}); $vb = ""; eval { $terminal->Trequire("vb"); $vb = $terminal->Tputs('vb', 1); }; print $vb; # ring visual bell 15.7.3. Discussion The "\a" escape is the same as "\cG", "\007", and "\x07". They all cor +respond to the ASCII BEL character and cause an irritating ding. In a + crowded terminal room at the end of the semester, this beeping cause +d by dozens of vi novices all trying to get out of insert mode at onc +e can be maddening. The visual bell is a workaround to avoid irritati +on. Based upon the polite principle that terminals should be seen and + not heard (at least, not in crowded rooms), some terminals let you b +riefly reverse the foreground and background colors to give a flash o +f light instead of an audible ring. Not every terminal supports the visual bell, which is why we eval the +code that finds it. If the terminal doesn't support it, Trequire will + die without having changed the value of $vb from "". If the terminal + does support it, the value of $vb will be set to the character seque +nce to flash the bell. There's a better approach to the bell issue in graphical terminal syst +ems like xterm. Many of these let you enable the visual bell from the + enclosing application itself, allowing all programs that blindly out +put a chr(7) to become less noisy.

In reply to Re^2: alarm() on windows 2003, overview by Anonymous Monk
in thread alarm() on windows 2003, overview by bonjedward

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.