Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing parameter around

Status
Not open for further replies.

adamcpng

Technical User
Jul 14, 2002
10
US
How can I passed parameter around? For example:

&db_select(qq[select * from apple where color='\$mycolor'])

sub db_select{
my $para1=shift;
my $mycolor="red";
...
print $para1;
}

is it a way that the "red" ($mycolor) will be passed into $para1 as "red" instead of the $mycolor??


Also, if I use system() to execute something, how can I read those output? I try to use @row=system(...), but I only get 0 or 1; i guess that is the return status. But, I can't get the return value. However, if I use subroutine, it seems like it works.

Can anyone please help? Thanks.


 
Code:
my $select = "select * from apple where color='$mycolor'";
&db_select($select);

sub db_select{
    my $query = shift;

    ...

    print $query;
}

M. Brooks
X Concepts LLC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top