perl pattern matching

Discussion in 'Perl' started by seema, Mar 12, 2005.

  1. seema

    seema Guest

    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
     
    seema, Mar 12, 2005
    #1
    1. Advertising

  2. seema

    Bob Walton Guest

    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.

    --
    Bob Walton
    Email: http://bwalton.com/cgi-bin/emailbob.pl
     
    Bob Walton, Mar 12, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Xah Lee
    Replies:
    9
    Views:
    873
    Chris Smith
    Feb 2, 2005
  2. Xah Lee
    Replies:
    4
    Views:
    630
    Aaron Sherman
    Feb 11, 2005
  3. Marc Bissonnette

    Pattern matching : not matching problem

    Marc Bissonnette, Jan 8, 2004, in forum: Perl Misc
    Replies:
    9
    Views:
    251
    Marc Bissonnette
    Jan 13, 2004
  4. Vandana

    Perl Pattern Matching-- Newbie

    Vandana, Jan 19, 2004, in forum: Perl Misc
    Replies:
    4
    Views:
    117
    Tad McClellan
    Jan 19, 2004
  5. Bobby Chamness
    Replies:
    2
    Views:
    248
    Xicheng Jia
    May 3, 2007
Loading...

Share This Page