Umar Draz am Montag, 3. Juli 2006 12:04:
> hi dear members!

Hello Umar

>   i am new in Perl community i want to declare a function and try to pass
> some parameters same as i do in php. First i declare a function (umar).
>
>
> sub umar ($width, $height) {
>     $area = $width * $height / 2;
>     return $area;
> }
>
> after that is I call function through a variable
> $result = umar(10,40);
> print "$result\n";
>
> But it did't work and i got a error
>
> Illegal character in prototype for main::umar : $width,$height at ./test.pl
> line 7. Malformed prototype for main::umar: $width,$height at ./test.pl
> line 12.
>
> please help me what should i do?

As with any language, the best thing is to get an idea about the language 
syntax.

In Perl, the syntax of subroutines is described in 

perldoc perlsub
(type this in the commandline: perldoc ist the command to get perl 
documentation, and perlsub ist the part of the documentation you wish to 
open)

The list of the local documentation (manuals) is available with

perldoc perl

How to use perldoc in

perldoc perldoc

and every builtin function's documentation is available with

perldoc -f <funktion_name_to_lookup>

If you intend to use perl on a regular basis, a good idea might be to buy a 
perl book, which gives, besides details, an overview of perl. A good start is 
the "Camel Book", "Programming Perl" from O'Reilly.

There are also websites dedicated to perl (as perlmonks.org, perl.org for 
example), and from cpan.org you can get a lot of perl modules for certain 
tasks.

Dani

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to