On Fri, Jul 18, 2003 at 06:05:52PM -0400, Benjamin Goldberg wrote:
What would happen if I used 1,2,3 instead of 1..3? Would it do the same
thing?
I would think so.
I wanna know what happens if I do:
@a[0,2,4] = qw/ a b c d e /;
Yup, you're right, I didn't consider
David Storrs wrote:
Thinking about it, I'd rather see lvalue slices become a nicer version
of Csplice().
my @start = (0..5);
my @a = @start;
@a[1..3] = qw/ a b c d e /;
print @a; # 0 a b c d e 4 5
What would happen if I used 1,2,3 instead of 1..3? Would it do
David Storrs wrote:
Thinking about it, I'd rather see lvalue slices become a nicer version
of Csplice().
my @start = (0..5);
my @a = @start;
@a[1..3] = qw/ a b c d e /;
print @a; # 0 a b c d e 4 5
What would happen if I used 1,2,3 instead of 1..3?
Luke Palmer wrote:
David Storrs wrote:
Thinking about it, I'd rather see lvalue slices become a nicer version
of Csplice().
my @start = (0..5);
my @a = @start;
@a[1..3] = qw/ a b c d e /;
print @a; # 0 a b c d e 4 5
What would happen if I
Luke Palmer [EMAIL PROTECTED] wrote:
Benjamin Goldberg wrote:
David Storrs wrote:
@a[1..3] = qw/ a b c d e /;
print @a; # 0 a b c d e 4 5
What would happen if I used 1,2,3 instead of 1..3? Would it do the same
thing?
Of course.
I tend to agree, I think. But see
Dave Whipp wrote:
Luke Palmer wrote:
Benjamin Goldberg wrote:
David Storrs wrote:
@a[1..3] = qw/ a b c d e /;
print @a; # 0 a b c d e 4 5
What would happen if I used 1,2,3 instead of 1..3?
Would it do the same thing?
Of course.
I tend to agree, I think.
Benjamin Golberg writes:
Luke Palmer wrote:
David Storrs wrote:
Thinking about it, I'd rather see lvalue slices become a nicer version
of Csplice().
my @start = (0..5);
my @a = @start;
@a[1..3] = qw/ a b c d e /;
print @a; # 0 a b c
On Tue, Jul 08, 2003 at 05:52:04PM -0700, Austin Hastings wrote:
--- Jonadab the Unsightly One [EMAIL PROTECTED] wrote:
Am I now thinking clearly?
I don't think so.
If you've created two separate arrays that happen to start with related
values, then the changes to the first won't
--- David Storrs [EMAIL PROTECTED] wrote:
On Tue, Jul 08, 2003 at 05:52:04PM -0700, Austin Hastings wrote:
--- Jonadab the Unsightly One [EMAIL PROTECTED] wrote:
Am I now thinking clearly?
I don't think so.
If you've created two separate arrays that happen to start with
David Storrs [EMAIL PROTECTED] writes:
my $r_slice = [EMAIL PROTECTED];
@$r_slice = qw/ a b c d e /;
print @a; # 0 a b c d e 4 5
This seems right to me. It would take approximately no time to get
used to this semantic, IMO.
# Note that it does NOT modify in rvalue
Jonadab the Unsightly One [EMAIL PROTECTED] writes:
Does this imply, though, that it's pointing to specific elements,
Wow, I wasn't paying attention to what I was thinking there.
Obviously it points to specific elements, because the subscripts used
to create a slice don't have to be sequential
--- Jonadab the Unsightly One [EMAIL PROTECTED] wrote:
Jonadab the Unsightly One [EMAIL PROTECTED] writes:
Does this imply, though, that it's pointing to specific elements,
Wow, I wasn't paying attention to what I was thinking there.
Obviously it points to specific elements, because the
Thinking about it, I'd rather see lvalue slices become a nicer version
of Csplice().
my @start = (0..5);
my @a = @start;
@a[1..3] = qw/ a b c d e /;
print @a; # 0 a b c d e 4 5
# Similarly:
@a = @start;
my $r_slice = [EMAIL PROTECTED];
@$r_slice =
On 5 Jul 2003, Luke Palmer wrote:
return [EMAIL PROTECTED] $begin .. $end ];
I fear that this might take a reference to each element in the slice,
rather than a reference to the slice
Yes, that would indeed return a list of refs in perl5. Can it also be
assumed that the magic
On Fri, 4 Jul 2003, Damian Conway wrote:
Will it be possible (or sane even) to bind a variable to an array slice
It *should* be, since it's possible (if ungainly) to do it in Perl 5:
Ouch, blatant abuse of perl5's aliasing with @_ and globs ;) Can I also
assume that you can also pass around a
On Fri, 4 Jul 2003, Damian Conway wrote:
Will it be possible (or sane even) to bind a variable to an array slice
It *should* be, since it's possible (if ungainly) to do it in Perl 5:
Ouch, blatant abuse of perl5's aliasing with @_ and globs ;) Can I also
assume that you can also pass
On Sat, Jul 05, 2003 at 09:51:29AM -0600, Luke Palmer wrote:
Actually, you can't reference a slice! Where the heck does the
reference point? I would probably do:
Of course not. I presume it points to something non-existent just like
a substring reference would in perl5 :-)
$ perl -le '$a =
On Sat, Jul 05, 2003 at 09:51:29AM -0600, Luke Palmer wrote:
Actually, you can't reference a slice! Where the heck does the
reference point? I would probably do:
Of course not. I presume it points to something non-existent just like
a substring reference would in perl5 :-)
$ perl
On Sat, Jul 05, 2003 at 09:51:29AM -0600, Luke Palmer wrote:
Actually, you can't reference a slice! Where the heck does the
reference point? I would probably do:
Of course not. I presume it points to something non-existent just like
a substring reference would in perl5 :-)
Will it be possible (or sane even) to bind a variable to an array slice
e.g
## correct syntax?
my @array = a list of values ;
my @array_slice := @array[ 1 .. @array.end ];
Or would this merely bind @array_slice to the list returned by the slice,
or would it DTRT (in my eyes at least) and
Will it be possible (or sane even) to bind a variable to an array slice
e.g
## correct syntax?
my @array = a list of values ;
my @array_slice := @array[ 1 .. @array.end ];
Yeah, that'll work. It has to, lest:
my [EMAIL PROTECTED] := (1, 1, map { $^a + $^b } zip(@fibs,
Dan Brook wrote:
Will it be possible (or sane even) to bind a variable to an array slice
It *should* be, since it's possible (if ungainly) to do it in Perl 5:
use Data::Dumper 'Dumper';
@bar = (1,2,3);
*foo = (sub [EMAIL PROTECTED])-(@bar[1,0,3]);
print Dumper [EMAIL PROTECTED];
22 matches
Mail list logo