Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Is this code correct

by linuxer (Curate)
on Jan 29, 2009 at 23:20 UTC ( [id://740069]=note: print w/replies, xml ) Need Help??


in reply to Is this code correct

sub info() { my ( $nick, $reply ) = @_; }

That doesn't make sense. sub info() declares info as a subroutine, which doesn't accept any arguments. Inside that subroutine you want to pass arguments to $nick and $reply.

See:

#!/usr/bin/perl use strict; use warnings; sub foobar() { my ( $foo, $bar ) = @_; print "foo: $foo\nbar: $bar\n"; } foobar( 1, 2 );

This results in:

Too many arguments for main::foobar at prot.pl line 11, near "2 )" prot.pl had compilation errors.

Please see perldoc perlsub; section Prototypes for details.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://740069]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2024-04-19 08:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found