On Monday 20 September 2010 09:49:27 rahul patil wrote: > Hello all, > > below is sample code i have written.Is it right way to declare ar4 which is > concatenation of ar and ar1 > > #!/usr/bin/perl > @ar = {"rahul","patil"};
You shouldn't use { ... } for arrays (this is not C). Use: my @ar = ("rahul", "patil"); A { ... } is an anonymous hash reference constructor. Also you should add "use strict;" and "use warnings;" to your code. See: http://perl-begin.org/tutorials/bad-elements/ Regards, Shlomi Fish > @ar1 = {"nitin"}; > @ar4 = {...@ar,@ar1}; > print @ar4[2]; > > if yes, why it is not printing output as nitin on my system -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Interview with Ben Collins-Sussman - http://shlom.in/sussman <rindolf> She's a hot chick. But she smokes. <go|dfish> She can smoke as long as she's smokin'. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/