diff options
Diffstat (limited to 't/pragma/strict-refs')
-rw-r--r-- | t/pragma/strict-refs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/t/pragma/strict-refs b/t/pragma/strict-refs index 6d36ff88c9..7bf1556e10 100644 --- a/t/pragma/strict-refs +++ b/t/pragma/strict-refs @@ -11,6 +11,8 @@ $c = @{"def"} ; $c = %{"def"} ; $c = *{"def"} ; $c = \&{"def"} ; +$c = def->[0]; +$c = def->{xyz}; EXPECT ######## @@ -72,6 +74,20 @@ EXPECT Can't use an undefined value as a symbol reference at - line 5. ######## +# strict refs - error +use strict 'refs' ; +my $a = fred->[0] ; +EXPECT +Can't use bareword ("fred") as an ARRAY ref while "strict refs" in use at - line 4. +######## + +# strict refs - error +use strict 'refs' ; +my $a = fred->{barney} ; +EXPECT +Can't use bareword ("fred") as a HASH ref while "strict refs" in use at - line 4. +######## + # strict refs - no error use strict ; no strict 'refs' ; |