On Wednesday, July 10, 2002, at 09:39 AM, Jeff 'japhy' Pinyan wrote:
> On Jul 10, George Schlossnagle said: > >> Am I alone in thinking that $x->[2] is much more readable that @$x[2] >> or $$x[2]? > > No; I always use the $ref->... syntax, unless I'm golfing. > >> @b[2] is an array slice with a single element (which strangely seems to >> get auto-cast as a scalar). > > All lists get auto-cast into a scalar, in scalar context. An array slice > is merely a list of array elements. > > $x = @y[2]; > > is the same as > > $x = ($y[2]); except you will get warnings on these lines. > > and > > $x = @y[1,3,5]; no warning on this. assumes you mean to only assign the last element. hmmm. > > is the same as > > $x = ($y[1], $y[3], $y[5]); > > which sets $x to $y[5]. > > -- > Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ > RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ > ** Look for "Regular Expressions in Perl" published by Manning, in 2002 * > * > <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. > [ I'm looking for programming work. If you like my work, let me know. > ] > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
