One question I've though is
if the w->curselection method returns a reference to an array (as seen from: ref w->curselection;) then how come:$,='|'; print w->curselection;prints the contents of the array.??? i.e. the contents of the array are flattened into a string and printed instead of dumping the reference (something like: ARRAY(0x38cfc) i.e. what happens when the reference is used as a string).
That method probably uses wantarray to figure out whether it's called in list or scalar context, and returns an array or array reference, as appropriate. Since print and friends provide list context, you get the array itself in your snippet.
Here's a simple demonstration of this behavior:
#!/usr/bin/perl use strict; use warnings; use feature qw/say/; sub test { my @list = (1, 2, 3); return wantarray ? @list : \@list; } $, = ","; say test(); my $ref = test(); say $ref;
This prints e.g.:
$ perl 1099646.pl 1,2,3 ARRAY(0x80071c80) $
In reply to Re^7: A TableMatrix row selection question
by AppleFritter
in thread A TableMatrix row selection question
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |