I wish to modify one particular line in perl script :
@list = ([$tmp[0],$tmp[1],$tmp[2]]);
I have change it to this:
if( $input == 3 )
{
@list = ([$tmp[0],$tmp[1],$tmp[2]]);
}
if( $input == 2 )
{
@list = ([$tmp[0],$tmp[1]]);
}
if( $input == 1 )
{
@list = ([$tmp[0]]);
}
Above code works, but I would like it to works with $input values up to 40 .
I try few different approaches but I am not able to code it in more elegant way, which really bother me.
Much appreciated any help with it.