Thread Globale Variable in BEGIN Block setzen: Interaktion von my, our, undef und BEGIN (25 answers)
Opened by murphy at 2005-09-15 04:25

Gast Gast
 2005-09-15 17:25
#58042 #58042
[quote=esskar,15.09.2005, 15:10]warum eigentlich nicht?`
Code: (dl )
my $uhu;
und
Code: (dl )
my $uhu = undef;
sind ja vollkommen äquivalent.[/quote]
Nicht auf 5.8.1 (das hatte ich gerade offen):
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
timon:/proj/work/rs/projects/runproc # perl
use strict;
use warnings;
my $stuff;
BEGIN { $stuff = 1; }
print "$stuff\n";
1
timon:/proj/work/rs/projects/runproc # perl
use strict;
use warnings;
my $stuff = undef;
BEGIN { $stuff = 1; }
print "$stuff\n";
Use of uninitialized value in concatenation (.) or string at - line 5.

timon:/proj/work/rs/projects/runproc #

View full thread Globale Variable in BEGIN Block setzen: Interaktion von my, our, undef und BEGIN