I'm new to Perl, learning from the beginning. I've read that $$ returns
The pid of the Perl process running this script.
as per below link,
http://www.tutorialspoint.com/perl/perl_special_variables.htm
I've the following Perl Script which is being executed on a Windows machine,
sub test
{
my ($surrogate_name) = @_;
if((defined $surrogate_name) && ($surrogate_name == 1))
{
print "Done!"."\n";
}
return $surrogate_name;
}
sub t
{
my ($surrogate_name) = @_;
my $record;
my $surrogate_value;
$record = &test($surrogate_name);
print $record."\n";
if ($record)
{
print "B"."\n";
$surrogate_value = $$record{$surrogate_name};
}
print $surrogate_value."\n";
print "A"."\n";
return $surrogate_value;
}
&t(1);
In this code, I observed everything is printed except the value of $surrogate_value.
Please clarify me what does $$ actually mean and why it's not returning anything in my script.
Thanks in advance...
use strictandwarnings. It looks like the$$here is either a typo, or a scalar dereference. - Patrick J. S.&to call subroutines, as in&test($surrogate_name)? Whatever it is, you should stop reading it as it is around twenty years out of date! Justtest($surrogate_name)is correct. - Borodin