Leser: 1
|< 1 2 >| | 16 Einträge, 2 Seiten |
open (EINLESEN, "<kjx2312.ght");
open (EINLESEN, "<kjx2312.ght") or die $!;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
open (EINLESEN, "<kjx3212.ght");
$passwort = <EINLESEN>;
chomp ($passwort);
close (EINLESEN);
$z = 1;
while ($z<=3)
{
print "\n";
print "Bitte Kennwort (Versuch nr.: $z):";
$eingabe = <>;
chomp ($eingabe);
if ($eingabe ne $passwort)
{
print "Leider falsch!!\n";
}
else
{
die "ok,Zutritt erteilt!\n";
}
$z++
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /pfad/zu/perl.exe
use strict;
use warnings;
open (EINLESEN, "<kjx3212.ght") or die $!;
my $passwort = <EINLESEN>;
chomp ($passwort);
close (EINLESEN);
my $z = 1;
while ($z<=3){
print "\n";
print "Bitte Kennwort (Versuch nr.: $z):";
my $eingabe = <STDIN>;
chomp ($eingabe);
if ($eingabe ne $passwort){
print "Leider falsch!!\n";
}
else{
die "ok,Zutritt erteilt!\n";
}
$z++
}
open (EINLESEN, "<kjx2312.ght") or die $1;
open (EINLESEN, "<kjx2312.ght") or die $!;
open (EINLESEN, "<kjx2312.ght") or die $1;
open (EINLESEN, "<kjx2312.ght") or die $!;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$OS_ERROR
$ERRNO
$! If used numerically, yields the current value of
the C "errno" variable, or in other words, if a
system or library call fails, it sets this vari-
able. This means that the value of $! is meaning-
ful only immediately after a failure:
if (open(FH, $filename)) {
# Here $! is meaningless.
...
} else {
# ONLY here is $! meaningful.
...
# Already here $! might be meaningless.
}
# Since here we might have either success or failure,
# here $! is meaningless.
In the above meaningless stands for anything:
zero, non-zero, "undef". A successful system or
library call does not set the variable to zero.
If used as a string, yields the corresponding sys-
tem error string. You can assign a number to $!
to set errno if, for instance, you want "$!" to
return the string for error n, or you want to set
the exit value for the die() operator. (Mnemonic:
What just went bang?)
Also see "Error Indicators".
|< 1 2 >| | 16 Einträge, 2 Seiten |