Balaji, next time when you reply please send it reply to the whole group, don't just sent it to myself. this gives the others a chance to help you.
On Thursday 12 February 2004 20:05, you wrote: > Hi David, > > Thanks for your answer. It is working but I dont know what > the dot operator signifies. I would appreciate if you could explain it > or refer me to any documentation. [snip] > > > > I would like to know the length of the anonymous array containing some > > elements. > > the usual trick use be used: > > #!/usr/bin/perl -w > use strict; > > my $h = {array => [1,3,5,7]}; > > print @{$h->{array}} . "\n"; > print $#{$h->{array}} . "\n"; > the dot operator does 2 things in this example: 1. it concatenates the two operants and creates a string out of them. 2. it forces both operants to be in scalar context. the second point is important, consider: print @{$h->{array}},"\n"; print $#{$h->{array}},"\n"; without the dot operator, it prints: 1357 3 because @{$h->{array}} is taken in list context by the 'print' function. david -- sub'_{print"@_ ";* \ = * __ ,\ & \} sub'__{print"@_ ";* \ = * ___ ,\ & \} sub'___{print"@_ ";* \ = * ____ ,\ & \} sub'____{print"@_,\n"}&{_+Just}(another)->(Perl)->(Hacker) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>