perlquestion
jesuashok
Hi Monks,
<p>
I know that In perl we can store any types of References using a single Scalar Variable;
<br></br>
like :-
<br></br>
$scale_ref = \$scalar;
<br></br>
$array_ref = \@array;
<br></br>
$hash_ref = \%hash'
<br></br>
I am devloping Modules which is going act as a Interface between many modules.
<br></br>
The requirement is as follows :-
<br></br>
* I want to make a Scalar Variable which has to hold only Array Reference.
<br></br>
For example :-
<br></br>
<code>
sub collect_all_users_from_tables {
$table_list = @_;
}
</code>
In the above example I want to make the $table_list to hold only Array reference.
<br></br>
Because as module developer I may not aware who is going to use my module. But I need to take care those
<br></br>
things in my module.
<br></br>
In othere Languages like C or C++ character pointer contain only character pointer.
<br></br>
I want the similaar things to be done in Perl also.
<br></br>
I know that this can be done in perl
<br></br>
But I am not aware of this. I hope monks will help me.
<br></br>
I need some efficient way of doing this.
<br></br>
This can be done by doing some explicit like
<br></br>
<code>
ref(@_) ne ARRAY' {
Carp 'Only Array can be processed';
}
</code>
Without explicit check is it possible to bring that future ?
<br></br>
</p>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-395537">
"Keep pouring your ideas"
</div></div>