perl pattern matching

S

seema

hi all,

I am a fresher, learning the Perl programming.
I have got a problem i just want to match old
C style function definition,
for example,
void hiall()
int k,j,l,m;
char *dare;
{
//BODY OF THE FUNCTION
}
If such old C style function definition exists
then i just need that function name. Hope somebody will
help a chinless wonder like me

Seema Rao
 
B

Bob Walton

seema wrote:

....
I have got a problem i just want to match old
C style function definition,
for example,
void hiall()
int k,j,l,m;
char *dare;
{
//BODY OF THE FUNCTION
}
If such old C style function definition exists
then i just need that function name. Hope somebody will
help a chinless wonder like me

Seema Rao

Please read:

perldoc perlsub

In Perl, functions are "sub"'s, and variables are declared with
"my". So it would go something like:

use warnings;
use strict;
#...
sub hiall{
my $k,$j,$l,$m,$dare;
#pick up incoming arguments if any from array @_
#do stuff
#return a value with the "return" statement, or
#otherwise return the value of the last statement
#executed
}
#...

Note that the type of value a variable may hold is not defined
ahead of time in Perl. Any variable may take on any valid value
at any time during program execution (generally string, integer,
floating point, filehandle, dirhandle, or reference, with
automatic conversion).

HTH.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top