Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Spotting an empty array as argument

by tobyink (Canon)
on Mar 26, 2021 at 10:11 UTC ( #11130371=note: print w/replies, xml ) Need Help??


in reply to Spotting an empty array as argument

How about this?

sub mysay (_) { print "$_\n" for @_ }

Replies are listed 'Best First'.
Re^2: Spotting an empty array as argument
by choroba (Archbishop) on Mar 26, 2021 at 12:09 UTC
    Try my test here.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
Re^2: Spotting an empty array as argument
by LanX (Sage) on Mar 26, 2021 at 12:22 UTC
        As it circumvents prototypes, it doesn't use $_ when no arguments are specified.

        map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11130371]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2021-10-24 19:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (89 votes). Check out past polls.

    Notices?