SPUG: while question

Yitzchak Scott-Thoennes sthoenna at efn.org
Tue Sep 16 17:33:02 CDT 2003


On Tue, Sep 16, 2003 at 03:05:52PM +0000, David Vergin <dvergin at igc.org> wrote:
> On Tue, 2003-09-16 at 19:26, Yitzchak Scott-Thoennes wrote:
> > If method() is always returning an explicit list...
> > ...
> > If method() is returning an array...
> 
> I would be interested to see two simple, contrasting examples of the two
> behaviors you describe.

Does this help?

$ perl -wlne'eval;print$@if$@'
print "  first: $INC[0]\n  last: $INC[-1]"
  first: /usr/lib/perl5/5.8.0/cygwin-multi-64int
  last: .
sub foo { @INC }
$x = foo; print $x
6
($x) = foo; print $x
/usr/lib/perl5/5.8.0/cygwin-multi-64int
# now try it with a slice (an array or hash or list converted to a list)
sub bar { @INC[0..$#INC] }
$x = bar; print $x
.
($x) = bar; print $x
/usr/lib/perl5/5.8.0/cygwin-multi-64int
exit



More information about the spug-list mailing list