Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: How can I use the values which is passed as arguments?

by anbutechie (Sexton)
on Mar 10, 2009 at 07:47 UTC ( [id://749519]=note: print w/replies, xml ) Need Help??


in reply to Re: How can I use the values which is passed as arguments?
in thread How can I use the values which is passed as arguments?

Thank you very much for your responce,
Subroutine definition : sub func(\$@$)
Subroutine call is : func($a, @b, Sc)
In this case, how can I get the parameters by the statement
($first, $second, $thrid)=@_
regards,
Anbarasu

Replies are listed 'Best First'.
Re^3: How can I use the values which is passed as arguments?
by GrandFather (Saint) on Mar 10, 2009 at 08:05 UTC

    subroutine prototypes in Perl are much discussed because generally using them is a bad idea. For a recent discussion see subroutine prototypes still bad?.

    The bottom line is: don't do that. And a follow up line is: Always use strictures (use strict; use warnings;).

    Instead of using prototypes consider:

    use strict; use warnings; my $str = 'Welcome'; my @array = qw(to the world of); serious ($str, \@array, 'Perl'); sub serious { my ($str, $arrayRef, $constStr) = @_; print join (' ', $str, @$arrayRef, $constStr), ".\n"; }

    Prints:

    Welcome to the world of Perl.

    True laziness is hard work
      Thank you, I got the solution
      Anbarasu

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-25 10:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found