Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Length of Array Passed as Reference

by afoken (Chancellor)
on Dec 10, 2020 at 08:21 UTC ( [id://11124930]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub test_function {
        my $ref = shift;    # this function takes one argument, a ref to a
    +n ARRAY
    ...
        # Not necessarily recommended: shown for educational purposes.
        defined($ref) or die "oops: you did not pass any arguments";
        @_ and die "oops: this function takes exactly one argument";
    
  2. or download this
    use strict;
    use warnings;
    ...
       test_function(undef);
    };
    say $@;
    
  3. or download this
    X:\>perl foo.pl
    Calling test_function with no arguments:
    ...
    
    
    X:\>
    
  4. or download this
    use strict;
    use warnings;
    ...
       test_function(undef);
    };
    say $@;
    
  5. or download this
    X:\>perl foo.pl
    Calling test_function with no arguments:
    ...
    
    
    X:\>
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-18 04:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found