Thread @ in Variablen (32 answers)
Opened by Knowbody at 2009-11-03 15:53

pq
 2009-11-03 16:06
#127713 #127713
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
um das mal zu demonstrieren:
Code (perl): (dl )
1
2
3
use strict;
use warnings;
my $string = "foo@bar.example";

Code: (dl )
1
2
3
Possible unintended interpolation of @bar in string at - line 3.
Global symbol "@bar" requires explicit package name at - line 3.
Execution of - aborted due to compilation errors.

das nenn ich doch mal eine hilfreiche fehlermeldung/warnung. wenn du dann noch nicht weisst, was "interpolation" bedeutet, kannst du das ja nachschlagen.
also, ab sofort nur noch mit strict arbeiten.

edit: use warnings
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread @ in Variablen