On Wed, 13 Feb 2002 at 02:29 GMT, Pankaj Warade wrote: > This is work > > my @array = ( 1, 2, 3, 4 ); > > print $#array; ---> size of array.
Actually, $#array holds the indices of the last element, not the size of the array. @array in scalar context returns the number of elements in the array #!/usr/bin/perl -w use strict; my @array = qw(1 2 3 4); print "Number of elements: ", scalar @array, "\n"; print "Last element: ", $#array, "\n"; __END__ -- briac << dynamic .sig on strike, we apologize for the inconvenience >> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]