[Perl] foreach - array

Craig Dunn craig en codenation.net
Jue Nov 17 09:36:12 CST 2005



> if ($config->{objetivos}->{host} =~ /ARRAY/)

if (ref($config->{objectivos}->{host}) eq 'ARRAY') { # Es mejor.

>      ¡¡ AQUI ES DONDE QUIERO IMPRIMIR EL TOTAL
>         DE ETIQUETAS <host> EN UN FOREACH  ¡¡¡

	for my $host ( @{$config->{objectivos}->{host}} ) {	
		print "$host\n";
	}

> }
> else
>  {
>   print "un solo host\n";
>  }

Saludos
Craig




Más información sobre la lista de distribución Perl