Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Perl Programmierung

Empfohlene Antworten

Hallo,

ich hätte mal ne Frage zu Perl. Würde gern wissen wie ich ne Eingabe per:

$var = <STDIN>;

verschlüssel kann, also dass für den Nutzer nur ein * erscheint, also für Passworteingaben und ähnliches.

Wäre nett wenn mir wer so nen Code geben könnte.

MfG

Nefa

ReadKey

Aber Sternchen sind glaube ich nicht möglich.

danke euch, probier ich gleich mal aus

also das hat alles gut geklappt, hab die eingabe fürs passwort versteckt, aber kann mir noch wer sagen wie ich dann statt überhaupt nichts nen * hin bekomm?

würde mich freuen wenn jemand sowas hätte


#!/usr/bin/perl -w


use strict;

use Term::ReadKey;


ReadMode(4);

my $key;

my $done = 0;

my $password = '';


do {

        # Check for keypress

        $key = ReadKey(-1);

        if (defined $key) {

                # if pressed, handle input

                # remember to also handle backspace & delete if

                # neccessary

                if ($key eq "\n") {

                        $done = 1;

                } else {

                        $password .= $key;

                        print "*";

                }

        } else {

                # else idle 0.1 secs to ease on cpu

                # without this, script would use 100% cpu

                select(undef,undef,undef,0.1);

        }

} until ($done);


ReadMode(0);

print "\n";

print "Your choice: $password \n";

exit(0);


ok, danke, muss ich nachher gleich mal testn obs klappt

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.