# Interpolation von Elementen use warnings; my $email; $email = "E-Mail"; print "$email = adam@perl.edu \n"; # FEHLERANZEIGE: Possible unintended interpolation of @perl in string at C:\Strawberry\perl\interpolation.pl line 7. Global symbol "@perl" requires explicit package name (did you forget to declare "my @perl"?) at C:\Strawberry\perl\interpolation.pl line 7. # Execution of C:\Strawberry\perl\interpolation.pl aborted due to compilation errors. # Trick: Escape @perl durch backslash print "$email = adam\@perl.edu \n"; #Alternativ: print "$email = 'adam@perl.edu' "; #Ausgabe des Compilers: #adam.edu #adam@perl.edu #adam@perl.edu # Ein einzelnes Element eines Arrays wird zu seinen Wert interpoliert, genau wie man es bei einer skalaren Variablen erwarten würde my (@adam, $y, $x); @adam = qw(Hello Dolly); $y = 2; print $x = "\n Hier wohnt $adam[1]\n"; print $x = "Hier wohnt $adam[$y-1]";