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: Problem mit getopts, Verstehe Warnung nicht...

Empfohlene Antworten

HI,

ich hab ein Problem: Ich übergebe beim Aufruf über die Komandozeile verschiedene Optionen an das Script mit. Es funktionieren alle Parameter, bis auf den der bei: <scriptname.pl> -h

eine Hilfe ausgeben soll.

So schaut das aus

getopts("hp:d:");

if (defined $opt_h)

gebe die Hilfe aus.

Wie gesagt, die opts, die weitere Argumente erwarten,, funktionieren wunderbar mit "defined". Sobald ich aber mein Script mit -h aufrufe, gibt er mir zwar die Hilfe auch aus, aber er bringt mir vorher folgenden Fehler:

Name "main::opt_h" used only once: possible typo at C:\Perl\bin\<meinscript.pl> line 26.

Und ich komm einfach nicht drauf, was ich flasch mache..

hab das Problem so eben gelöst, hab nen Tip bekommen, dass man einen Tricvk anwenden muss und zwar: opt_h=opt_h (keine Ahnung, warum das so ist, aber es geht ;))

Auserdem is der QT 300 Zeilen lang :D

hi,

deine fehlermeldung ist keine. es ist lediglich ein hinweis das die besagte variable nur einmal verwendet wird und die frage ob es sich eventuel um einen tippfeher handelt.

mit deiner jetzt eingefügten zeile wird die variable mehr als einmal verwendet und der hinweis kommt nicht mehr

that's all

/wingman

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.