sub sinode{
my %node=(val=>undef, ref=>undef);
if(@_>1){
$node{val}=shift();
$node{ref}=shift();
}
else{
if(@_=1){
$node{val}=shift();
}
}
return \%node;
}
$temp=undef;
foreach (qw(5 4 3 2 1)){
$node=sinode($_, $temp);
$temp=$node;
}
do{
printf("$node->{val}\n");
$node=$node->{ref};
}until($node eq undef)