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, near "'!';"
####
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 script.pl line 11.