Thread Parameterübergabe an eine Funktion (7 answers)
Opened by GwenDragon at 2005-03-15 16:26

Ronnie
 2005-03-15 17:39
#52701 #52701
User since
2003-08-14
2022 Artikel
BenutzerIn
[default_avatar]
Man kann auch alles in ein anonymes Hash stopfen:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl

use strict;
use warnings;

use Data::Dumper;

my @numbers = (1..10);
my @words = qw(hello world outside);

function( {NUMBERS=>\@numbers , WORDS=>\@words} );
exit;

sub function {
die "Keine Parameter übergeben!\n" unless @_;
my %opt = %{ shift @_ };
print Dumper \%opt;

my @i_words = $opt{WORDS};
print Dumper \@i_words;

my @i_numbers = $opt{NUMBERS};
print Dumper \@i_numbers;
}
\n\n

<!--EDIT|Ronnie|1110908950-->

View full thread Parameterübergabe an eine Funktion