Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Passing multiple data types to a subroutine

by Chmrr (Vicar)
on Nov 28, 2003 at 20:20 UTC ( [id://310784]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @array = (42,43,44,45);
    my $scalar1 = 1;
    my $scalar2 = 2;
    ...
      $s2 += 33;
      return ($s1, $s2);
    }
    
  2. or download this
    main::my_subroutine() called too early to check prototype at - line 5.
    Can't use string ("42") as an ARRAY ref while "strict refs" in use at 
    +- line 9.
    
  3. or download this
    sub my_subroutine(\@$$) {
      my @a = @{shift()};
      my $s1 = shift();
    ...
    
    ($scalar1,$scalar2) = my_subroutine(@array,$scalar1, $scalar2);
    print "$scalar1 $scalar2\n";
    

Log In?
Username:
Password:

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

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

    No recent polls found