printing array contents after "push" of elements gives a different output in PERL
hi,
i have a doubt in printing the contents of an array after doing "push" on it. The question goes as follows. @arr=qw(1 2 3 4 5); print @arr; print "@arr"; The above yields 1 2 3 4 5 1 2 3 4 5 which is nothing but contents of the array. suppose, @arr=qw(1 2 3 4 5); @arr=push(@arr,"a"); print @arr; print "@arr"; The above yields the array count with o/p as 6 6 . Could somebody tell why is it so. Also tell me how to get the contents of the array? I tried opening a foreach loop for the array and tried printing element by element. This again yielded the array count than its contents. Ur explanation is highly appreciated. Thanks ~ gaynut |
Code:
man perlfunc |
All times are GMT -5. The time now is 02:06 AM. |