Do you know what "$::n;" means ? The section of codes is like below.
use JSON::XS;
# ...
open (YI, "| $cmd");
my $msg = { test => test };
my $emsg = encode_json($msg);
print YI "$msg_inject\n" unless $::n;
close YI;`
I remmeber that I also met $::v before. What is $::v ? Does it have additional usage ?
I only know $: is reserved word for a perl statment with more lines being filling in a field.
Best regards,
TWLMD.
Just as with the =~ regex match operator, the left side is the "subject" of the match, and the right side is the "pattern" to match against -- whether that be a plain scalar, a regex, an array or hash reference, a code reference, or whatever.
$#array is the subscript of the last element of the array (which is one less than the length of the array, since arrays start from zero). Assigning to $#array changes the length of the array @array, hence you can destroy (or clear) all values of the array between the last element and the newly assigned position.
The former is a function call. The latter is a method call.
1 at the end of a module means that the module returns true to use/require statements. It can be used to tell if module initialization is successful. Otherwise, use/require will fail.
$::n
is same as $main::n
or just $n
where $n is residing in main::
package.
Such notation ignores eventual lexical (defined with my
) definition of $n
, ie.
perl -Mstrict -we 'our $n=3; my $n=1; print $::n'
output is 3
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