1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/usr/bin/perl -w use strict; use warnings; my $test = 'a,b,c'; test ([split /\,/,$test]); print "haupt: " . $test . "\n"; sub test { my ($t) = @_; print "sub sagt: " . $t -> [2] . "\n"; $t -> [0] = 'z'; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/usr/bin/perl -w use strict; use warnings; my $test = 'a,b,c'; my $array = [split /\,/,$test]; test ($array); print "haupt: @$array\n"; sub test { my ($t) = @_; print "sub sagt: " . $t -> [2] . "\n"; $t -> [0] = 'z'; }
2011-04-29T18:23:28 GwenDragonDu wolltest wohl sowas:
2011-04-29T18:23:28 GwenDragonDu veränderst in deinem Programm in Zeile 13 nur den Inhalt des anonymen Arrays, das in Zeile 7 übergeben wurde
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/usr/bin/perl -w use strict; use warnings; my $test = 'a,b,c'; test ($test); print "haupt: " . $test . "\n"; sub test { my $t = [split /\,/,$_[0]]; print "sub sagt: " . $t -> [2] . "\n"; $t -> [0] = 'z'; }