All this clearly points to variables. In 99.9% of cases, this is a mistake for beginners.
There are things that can happen as a side effect of this calling style:
my $foo = "1234"; sub bar { $_[0] =~ s/2/two/ } print "Foo is $foo\n"; bar( "$foo" ); print "Foo is $foo\n"; bar( $foo ); print "Foo is $foo\n";
Here, the gating created a copy and passed it to the subroutine, bypassing Perl's passage through referential semantics. These are generally considered bad manners for invoking call variables, so you're probably all right.
Here you can also strengthen an object or other meaning. For example, undef builds an empty string. Objects can specify arbitrary code to run during streaming. It is possible to have two-digit scalars that have different numeric and string values. This is a way to indicate that you need a string form.
There is also one stupid thing that can go on. If you are working with an XS code that looks at the flags specified for scalar function arguments, then a strict scalar is a direct way to tell perl: “Make me a good clean new string value” with strict flags only and no numerical flags.
I am sure there are other odd exceptions to the rule of 99.9%. This is a few. Before you remove the quotes, take a second to check this strange shit. If you really use legitimate use, add a comment that identifies the quotation marks as a workable kludge and gives a reason to exist.
daotoad
source share