in reply to sub variables

> In Perl 5, is there a way to name my variables in the () of the sub declaration,

Yes newer Perl versions have an experimental new feature for signatures

see https://www.effectiveperlprogramming.com/2015/04/use-v5-20-subroutine-signatures/

> sub DoSomething( $DataStr ) {;}

Yes, positional arguments are supported.

Even with mandatory arguments or optional arguments with default values.

> as I do in Perl 6?

Not really.

Perl6 allows much more, like named variables, types and constraints

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

Replies are listed 'Best First'.
Re^2: sub variables
by Todd Chester (Scribe) on Jul 23, 2017 at 00:46 UTC
    Thank you!
    I am on 5.16.3
    Rats!

      I wrote a simplicistic source filter to bring the subroutine signatures to almost all versions of Perl. The module is Filter::signatures.

        Corion, I've honestly never used signatures (or prototypes) except for very basic playing/testing, but what you've done here is pretty awesome. Pure Perl for the win even.