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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send a variable to a sub

Status
Not open for further replies.

PasPy

Programmer
May 16, 2002
11
CA
hi,

when I call my cgi's sub like this :
so I want to send the variable 1003 to the sub delete.

#first, at the top of the scripts when I look which sub is called i can see which is called and wath is the variable, so my trouble is when I want to send it to the sub,.

(...)# $delete is the variable of "delete" ,the action of
(ex.cgi?delete)

elsif ($delete ne "") # if the variable ( NE "" ) then call # &delete and send the variable

$delete to the sub
{
&delete($delete);
}



# thanks to take yours precious time to help me.

sincerely, PaSpY
 
So what is the problem - in ex.cgi can you see variable "delete" coming in with value "1003"?

If you have variable $delete with value "1003" in it, then to get it to subroutine "delete", do this:

delete($delete); # call "delete" subroutine with the value
# of $delete variable


sub delete {
my $delete = shift; # get value passed in to this "delete"
# subroutine

### do something with $delete ###

} #end sub delete

HTH. Hardy Merrill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top