The above code . i am writing push function. I passed @a as a reference and i add 5 at end of the array. i print @a in main program. because i am passing reference. Then In actual push statement(push(@a,5)),without using reference,how its work?@a=(1,2,3,4); push1(\@a,5); print @a; sub push1{ $ref =shift; @a = @$ref; $s=shift; $len=scalar @a; $a[$len] =$s; return \@a; }
In reply to technique of push by saranperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |