User Tools

Site Tools


kurs:sub.pl
$a = 3;
$b = 2;

## printf "%s\n", add($a, $b) ;

@b = (1,2,3,4,5,6);
$r = [1,2,3,4,5,6];

$h = {a => 1,
	    b => 2,
	   };

print Dumper $h;

printf "array %s %s %s\n", $r->[3], ${@$r}[3], $b[3] ;
printf "hash %s\n", $h->{a};

### nicht ### print " $r->[3] \n";

printf "array %s\n", ref($r) ;

printf "%s\n", add_array($r) ;
print "bin in Zeile " .__LINE__;

exit(0);

sub add_array {
	my ($c_ref) = @_;
		
	printf "ref %s\n", ref($c_ref);	
	
	
	my $d;
	foreach (@$c_ref) {
	  $d += $_; 
	}
	$d;
}
	

sub add {
  my ($a, $b) = @_;
  my $c = $a+$b;  
  return $c;
  }
kurs/sub.pl.txt · Last modified: 2014/09/10 21:22 (external edit)