develooper Front page | perl.perl5.porters | Postings from March 2023

Re: Questions about the my Foo $var syntax

Thread Previous | Thread Next
"Ruud H.G. van Tol" via perl5-porters
March 13, 2023 11:58
Re: Questions about the my Foo $var syntax
Message ID:

On 2023-03-13 12:29, Robert Rothenberg wrote:
> There's some legacy syntax still used in some very old code bases, 
> e.g. TheSchwartz
>   my TheSchwartz::Job $job = shift;
> As far as I can tell, this doesn't do anything except require that 
> TheSchwartz::Job namespace exists. It doesn't require $job to be a 
> TheSchwartz::Job.

See also `perldoc fields`.

-- Ruud

perl -Mstrict -wE'
   use Data::Dumper; {package Data::Dumper; our 
   sub T_Int { print __PACKAGE__, "::T_Int: ", Dumper(\@_); $_//= \1 for 
@_ }
   T_Int my ($x, $y);
   print "[x,y]=", Dumper([$x, $y]);

main::T_Int: [

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About