use lib ".";
use SparseVector;

tie my @x, SparseVector;
tie my @y, SparseVector;

$x[1]=17;
$x[17]=1;

$y[2]=3;
$y[3]=7;
$y[7]=1;

# Get the tied objects
$x = tied @x;
$y = tied @y;
$z = tied @z;

# Perform overloaded addition
$w = $x + $y;

# Print using custom string conversion
print $w, "\n";

# Copy x to u(not tied) using array copy
@u = @x;

# Print using array string conversion
print "\@u = ", join(",", @u), "\n";

# Overloaded @{} operator returns a tied array
@v = @{$w};

# Verify that copy worked as expected
print "\@v = ", join(",", @v), "\n";

# Print array style
print "\@\$w = ", join(",", @$w), "\n";

untie @x;
untie @y;

