• 🏠 Home
  • 🧰 Online Generators
  • 📰 Blog
  • 🔎 Search
  • 📧 Contact
  • 📘 Guestbook
  • 🗞️ News
  • 💰 Support
  •  

    Sorry, but this page is not yet available in english.

    Clic here to send a translate request


    Programmation Perl - Fonction d'attente visuelle (vSleep: Visual Sleep)


    Cette fonction va attendre le temps spécifié, et afficher un compte à rebouts à l'écran.

    Le code

    sub vSleep {
        local $| = 1;
        my $sleepTime = $_[0];
        printf("Sleeping for $sleepTime seconds...\n");
        my $i=$sleepTime;
        while ($i>0) {
            print "$i... ";
            $i=$i-1;
            sleep(1);
        }
        printf("\n");
    }
    
    
    vSleep(10);
    

    Résultat

      
      Sleeping for 10 seconds...
      10... 9... 8... 7... 6... 5... 4... 3... 2... 1...
      

       

      Retour


    (c) 2005-2025 Jérôme DESMOULINS
    Data privacy