[EMAIL PROTECTED] schreef: > sub graph > { > my @Xvalues = @{ $_[0] }; # remember to use "my"! > my @Yvalues = @{ $_[1] }; # remember to use "my"!
A graph subroutine is not likely to change the input data, so there is no reason to copy the input data. my ($xValues, $yValues) = @_; and then use @xValues and @yValues where you need the arrays, and $xValues->[$i] where you need the array elements. $ perl -Mstrict -we' sub graph { my ($xValues, $yValues) = @_; for my $i (0 .. $#$xValues) { printf "%4d %s\n", $xValues->[$i], "#" x $yValues->[$i], } } my @x = (1, 2, 3); my @y = (7, 2, 5); graph [EMAIL PROTECTED], [EMAIL PROTECTED]; __END__ ' 1 ####### 2 ## 3 ##### You could also choose to store the x- and y-values together in one array. You could also choose to store the x- and y-values together in one array: my $data = [ [1, 7], [2, 2], [3, 5], ]; -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/