On Mon, Apr 18, 2005 at 06:44:55PM -0400, Kurt Hutchinson wrote: : On Mon, Apr 18, 2005 at 11:23:34PM +0300, Roie Marianer wrote: : > That makes sense, but that would make : > %num_of_lines<file> = @file : > not DWIM... of course that would translate into : > %num_of_lines<file> = scalar @file : > so maybe that's OK. : : In order to promote proper syntactical thinking, note that this is now : spelled: : : %num_of_lines<file> = @file.elems;
Or more succinctly: %num_of_lines<file> = [EMAIL PROTECTED]; : because the Perl 5 way would put a reference to @file in the hash. : Scalar context always makes references now, from what I understand. Interestingly, a stored reference would track the current number of lines rather than taking a snapshot. But you should definitely think of it as storing a reference rather than the number of lines, because the ref will certainly behave differently in string context. Larry