sub max_v_local {
local (*a, *b) = @_;
my $n = @a > @b ? @a : @b;
my @result;
for( my $i = 0; $i < $n; $i++ ) {
push @result, $a[$i] > $b[$i] ? $a[$i] : $b[$i];
}
@result;
}
####
my @answer = max_v_local( \@mylist, \@yourlist );
####
sub test_xml_writer {
my( @array, $aref );
my $io = new IO::File 'getline( $io );
$#{ $aref } > -1 ? push @array, $aref : last;
}
$io->close();
$io = new IO::File '>test-out.xml' or die "Could not open output file";
my $w = new XML::Writer( OUTPUT => $io, DATA_MODE => 1, DATA_INDENT => 2 );
$w->xmlDecl( undef , 1 );
$w->startTag( 'assets' );
foreach ( @array ) {
$w->startTag( 'machine' );
my @c = qw( name ip_address snmp_community grbr model_serial );
local *a = $_;
# my @a = @{$_};
$w->dataElement( $c[0], $a[0], src => 'netview' ) if defined $a[0];
$w->dataElement( $c[1], $a[1] ) if defined $a[1];
$w->dataElement( $c[2], $a[2], type => 'rw' ) if defined $a[2];
$w->dataElement( $c[3], $a[3], src => 'data' ) if defined $a[3];
$w->dataElement( $c[4], $a[4], src => 'data' ) if defined $a[4];
$w->endTag();
}
$w->endTag();
$w->end();
$io->close();
}
####
Variable "@a" is not imported at ./test.pl line 112.
Variable "@a" is not imported at ./test.pl line 112.
Variable "@a" is not imported at ./test.pl line 113.
Variable "@a" is not imported at ./test.pl line 113.
Variable "@a" is not imported at ./test.pl line 114.
Variable "@a" is not imported at ./test.pl line 114.
Variable "@a" is not imported at ./test.pl line 115.
Variable "@a" is not imported at ./test.pl line 115.
Variable "@a" is not imported at ./test.pl line 116.
Variable "@a" is not imported at ./test.pl line 116.
Global symbol "@a" requires explicit package name at ./test.pl line 112.
Global symbol "@a" requires explicit package name at ./test.pl line 112.
Global symbol "@a" requires explicit package name at ./test.pl line 113.
Global symbol "@a" requires explicit package name at ./test.pl line 113.
Global symbol "@a" requires explicit package name at ./test.pl line 114.
Global symbol "@a" requires explicit package name at ./test.pl line 114.
Global symbol "@a" requires explicit package name at ./test.pl line 115.
Global symbol "@a" requires explicit package name at ./test.pl line 115.
Global symbol "@a" requires explicit package name at ./test.pl line 116.
Global symbol "@a" requires explicit package name at ./test.pl line 116.
Execution of ./test.pl aborted due to compilation errors.