I wish to write a function “concat” such that the variable $concatstring will contain a concatenation of the three string variables listed. The function needs to be called from within various functions, and the name $concatstring may not be the same each time. Each of the string variables will require either one or two \t characters adding to it before concatenation, depending on the length of the string. This code is to be executed within the concat subroutine. I wish to achieve an output that looks something like the following:sub somefunction { while (expression) { . . $concatstring = &concat ($string1, $string2, $string3); print “$concatstring\n”; } } sub concat { }
My problem comes because I do not know how to return the finished string from the concat function. I have no problem with the basic logic of appending \t to a string. Any help would be greatly appreciated.longstring longstring X X X longstring X longstring longstring
edited: Sun Jan 19 00:35:04 2003 by jeffa - title change (was: Help with subroutines)
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |