The variable $$ is, as you've written, PID of current process: print $$ . "\n"; What you've written in your script is $$record{$surrogate_name} , which means accessing an element of a hash and is equivalent to $record->{$surrogate_name} . Other from that, $$name usually means dereferencing a reference to a scalar.
$1 equals the text " brown ".
In addition, Perl defines the following: \w Match a "word" character (alphanumeric plus "_") \W Match a non-word character \s Match a whitespace character \S Match a non-whitespace character \d Match a digit character \D Match a non-digit character.
The most commonly used special variable is $_, which contains the default input and pattern-searching string. For example, in the following lines − #!/usr/bin/perl foreach ('hickory','dickory','doc') { print $_; print "\n"; }
Possible Duplicate:
What does =~ do in Perl?
In a Perl program I am examining (namly plutil.pl), I see a lot of =~
on the XML parser portion. For example, here is the function UnfixXMLString
(lines 159
to 167
on 1.7 ($VERSION
wrongly declared as "1.5")):
sub UnfixXMLString {
my ($s) = @_;
$s =~ s/</</g;
$s =~ s/>/>/g;
$s =~ s/&/&/g;
return $s;
}
From what I can tell, its C prototype would be (C-like) string UnfixXMLString(string s)
, and it uses the =~
operator on the parameter (s
) and then returns the modified string, but what is it doing?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With