Is this a bug or a feature?
Or is it just me? :)

!/usr/bin/perl -w
use strict;
use warnings;

my $variable = "variable";
my @array = qw(this is an array);
my %hash = qw(1 this 2 is 3 a 4 hash); ## correct syntax

my $rvariable = \$variable;
my $rhash = \%hash;  ## correct syntax
my $rarray = \@array;


print "\$variable from reference: $$rvariable\n";
print "\@array from reference: @$rarray[0] @$rarray[1] @$rarray[2]
@$rarray[3]\n";
print "\%hash from reference: %$rhash{1} %$rhash{2} %$rhash{3}
%$rhash{4}\n"; ## correct syntax

[localhost:~/Perl/Advanced Perl] tor% ./1.pl
Global symbol "%rhash" requires explicit package name at ./1.pl line 16.
Global symbol "%rhash" requires explicit package name at ./1.pl line 16.
Global symbol "%rhash" requires explicit package name at ./1.pl line 16.
Global symbol "%rhash" requires explicit package name at ./1.pl line 16.
Execution of ./1.pl aborted due to compilation errors.

I simply can't see that anything is wrong with my syntax.

If I remove -w, use warnings; and use strict;

[localhost:~/Perl/Advanced Perl] tor% ./1.pl
$variable from reference: variable
@array from reference: this is an array
%hash from reference: % % % %

Anyone know why this is happening?

-- 
T.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to