Thread Subroutinen und listen als Parameter. (16 answers)
Opened by toby at 2006-04-22 13:39

pq
 2006-04-23 17:34
#65216 #65216
User since
2003-08-04
12209 Artikel
Admin1
[Homepage]
user image
[quote=Matze,23.04.2006, 11:46]Entschuldige, mir my() funktioniert es ja nicht, aber mit local:
[code mit local, typeglobs und ohne strict...]
Das funktioniert!

Allerdings weiß ich nicht mehr, wie man 'use strict' miteinbinden
kann damit es auch dann noch funktioniert. :(
Ich werde mich aber nochmal erkundigen.[/quote]
was genau ist jetzt das problem an dem code hier:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl
use warnings;
use strict;

my $a = "abc";
my $b = "123";
my @a = qw(a b c);
my @b = qw(1 2 3);

subroutine($a,\@a,$b,\@b);

sub subroutine {
  my ($sa,$aa,$sb,$ab) = (@_);

  print "$sa\n$sb\n";
  print "@$aa\n@$ab\n";
}
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 Subroutinen und listen als Parameter.