As you can see, the answer is a bit more complex than it would seem. If you
go by what ref() says, there 4+. If you go by their fundamental structure
there are just scalar they are interpolated into whatever it should be.

That said, when you deal with most things, using references are the best. It
is much easier to say, 'pass me a hashref and you can define these things'
and you just do:
$ref->{ 'one' } = this;
$ref->{ 'two' } = Some::Module->new( toy );

$returnme = func( $ref );

And all func() has to do is:
my $thing = $_[0];

And then, use $thing->{ 'one' } and $thing->{ 'two' } just like you would
$ref outside your function. And modifying the reference shows up everywhere.
That's it.
On Jul 29, 2011 6:58 PM, "Rajeev Prasad" <rp.ne...@yahoo.com> wrote:
> Hello,
>
> from here: http://www.troubleshooters.com/codecorn/littperl/perlsub.htm
>
> i found:
>
> In Perl, you can pass only one kind of argument to a subroutine: a scalar.
> To pass any other kind of argument, you need to convert it to a scalar.
You
> do that by passing a reference to it. A reference to anything is a
> scalar. If you're a C programmer you can think of a reference as a pointer
> (sort of).
>
> is that still true? date on website is 2003...
>
> thank you.
>
> Rajeev

Reply via email to