> -----Original Message-----
> From: [EMAIL PROTECTED]

> 
> 
> 
> use strict;
> 
> my $link_id = '';
> my $link_attr_entry_list_ref = '';

The var above is in the package::main name space.

> ....
> 
> get_link_attr_entry_list($link_id);
> get_link_priority($link_attr_entry_list_ref);
> ....
> 
> ##############################################################
> sub get_link_attr_entry_list {
> 
>     my $link_id = $_[0];
>     
>     @link_attr_entry_list = $linkattrdb->find_using_linkid($link_id);
>     my $link_attr_entry_list_ref = \@link_attr_entry_list;
> 
>     return $link_attr_entry_list_ref;

This variable is different than the one declared in package::main. This
variable is local to the enclosing block and cannot be seen outside of the
get_link_attr_entry_list {} routine. When you return this reference to the
package::main block you are not using it either. 

> 
> }
> 
> 
> sub get_link_priority {
> 
>     my $link_attr_entry_list_ref = $_[0];
>     my @link_attr_entry_list = @$link_attr_entry_list_ref;
> 
>     foreach my $link_attr_entry (@link_attr_entry_list) {
>       ...
> }

Try something like the following 
###########################################################
#!perl
 use warnings;
 use strict;
 
 my $link_id = '';
 my $link_attr_entry_list_ref = '';
 
 my $returned_reference = get_link_attr_entry_list($link_id);
 get_link_priority($returned_reference);
 ....
 
 ##############################################################
 sub get_link_attr_entry_list {
 
     my $link_id = $_[0];
     
     @link_attr_entry_list = $linkattrdb->find_using_linkid($link_id);
     my $link_attr_entry_list_ref = \@link_attr_entry_list;
 
     return $link_attr_entry_list_ref;
 
 }
 
 
 sub get_link_priority {
 
     my $link_attr_entry_list_ref = $_[0];
     my @link_attr_entry_list = @$link_attr_entry_list_ref;
 
     foreach my $link_attr_entry (@link_attr_entry_list) {
        ...
 }


#####################################################################

 This is a common pitfall. Have a look on google for "Coping with Scoping"
by MJD. To achieve what you wanted another method could have been the
following but I am not sure if this is wise.

###########################################################
#!perl
 use warnings;
 use strict;
 
 my $link_id = '';
 my $link_attr_entry_list_ref = '';
 
 
 get_link_priority(get_link_attr_entry_list($link_id);
 ....
 
 ##############################################################
 sub get_link_attr_entry_list {
 
     my $link_id = $_[0];
     
     @link_attr_entry_list = $linkattrdb->find_using_linkid($link_id);
     my $link_attr_entry_list_ref = \@link_attr_entry_list;
 
     return $link_attr_entry_list_ref;
 
 }
 
 
 sub get_link_priority {
 
     my $link_attr_entry_list_ref = $_[0];
     my @link_attr_entry_list = @$link_attr_entry_list_ref;
 
     foreach my $link_attr_entry (@link_attr_entry_list) {
        ...
 }


#####################################################################

I doubt if the above message is wise. If anyone can elaborate I would like
to know when you use this

 get_link_attr_entry_list($link_id);
 
 is there a global variable that is used in the return value that could be
used as the next parameter in another sub routine?

Harry







*************************************************************************************
COLT Telecommunications
Registered in England No. 2452736
Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ
Tel. +44 20 7390 3900

This message is subject to and does not create or vary any contractual
relationship between COLT Telecommunications, its subsidiaries or 
affiliates ("COLT") and you. Internet communications are not secure
and therefore COLT does not accept legal responsibility for the
contents of this message.  Any view or opinions expressed are those of
the author. The message is intended for the addressee only and its
contents and any attached files are strictly confidential. If you have
received it in error, please telephone the number above. Thank you.
*************************************************************************************


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to