Thread Problem beim Auslesen einer Datei: war: kjx2312.ght (15 answers)
Opened by Gast at 2005-03-08 13:06

renee
 2005-03-08 13:50
#52424 #52424
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
[quote=Relais,08.03.2005, 12:47][quote=renee,08.03.2005, 12:15]
Code: (dl )
open (EINLESEN, "<kjx2312.ght") or die $1;
[/quote]
es muss $! heissen, nicht $1.

Code: (dl )
open (EINLESEN, "<kjx2312.ght") or die $!;
[/quote]
Hab's geƤndert, im anderen Posting war's gleich richtig...

Auszug aus perldoc perlvar:
Code: (dl )
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".
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Problem beim Auslesen einer Datei: war: kjx2312.ght