Hi,
I have a strange problem with following code.
code1:
#!/usr/local/bin/perl
my $temp;
my $str;
$str = 'test';
$temp = 'str';
print ${$temp}."\n";
Only a blank line was printed, however if I got ride of the declaration of $str, ie
code 2:
#!/usr/local/bin/perl
my $temp;
$str = 'test';
$temp = 'str';
print ${$temp}."\n";
The output is: test
That's what I wanted, but I don't know why code 1 doesn't work?
Thanks,
George
I have a strange problem with following code.
code1:
#!/usr/local/bin/perl
my $temp;
my $str;
$str = 'test';
$temp = 'str';
print ${$temp}."\n";
Only a blank line was printed, however if I got ride of the declaration of $str, ie
code 2:
#!/usr/local/bin/perl
my $temp;
$str = 'test';
$temp = 'str';
print ${$temp}."\n";
The output is: test
That's what I wanted, but I don't know why code 1 doesn't work?
Thanks,
George