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.
&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.