in reply to Re^4: Splitting array into two with a regex
in thread Splitting array into two with a regex
Can you back that up? I can't find any way of using it as an lvalue. Everything I tried gave me a count (in scalar context) or a list (in list context). Some tests:
use strict; use warnings; my @array = qw( a b c d e ); sub test { return @array; } (test())[0] = '!'; __END__ Can't modify list slice in scalar assignment at script.pl line 10, nea +r "'!';"
use strict; use warnings; my @array = qw( a b c d e ); sub test { return @array; } test() = qw( A B C D E ); __END__ Can't modify non-lvalue subroutine call in scalar assignment at script +.pl line 10, near "qw( A B C D E );"
use strict; use warnings; my @array = qw( a b c d e ); sub test { return @array; } my $aref = \(test()); @{$aref} = qw( A B C D E ); __END__ Not an ARRAY reference at script.pl line 11.
use strict; use warnings; my @array = qw( a b c d e ); sub test { return @array; } sub test2(@) { print(scalar @{$_[0]}, "\n"); } test2(test()); __END__ Can't use string ("a") as an ARRAY ref while "strict refs" in use at s +cript.pl line 11.
Are you talking about guts? I don't know anything about those. I was talking about the language.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Splitting array into two with a regex
by merlyn (Sage) on Nov 08, 2005 at 19:49 UTC | |
by ikegami (Patriarch) on Nov 08, 2005 at 19:52 UTC | |
|
Re^6: Splitting array into two with a regex
by dragonchild (Archbishop) on Nov 08, 2005 at 20:00 UTC |