User Control Panel
Advertisements

HELP US, HELP YOU!

sub error

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl
View unanswered posts
Author Message
dubbeld
Newbie
Newbie


Joined: 23 Jan 2005
Posts: 9

Reputation: 15.8Reputation: 15.8

PostPosted: Wed Mar 23, 2005 2:44 pm    Post subject: Reply with quote

I've got the following error:

When I try to execute the following script:
Code:
use strict;<br /><br />sub version {<br /> print "something else";<br />}<br /><br />my $something = "version";<br /><br />&{$something};


it will go:

Code:
Can't use string ("version") as a subroutine ref while "strict refs" in use at test.pl line 9.


(if I don't use strict it will work... but I want to use it...)

In Juggernaut it works with the following script (and it uses strict)...

Code:
$reply = &{$current} ($self,$client,$msg,$listener) || panic ("Bad command form: no reply", 1);


How can i solve this at my script?
Back to top
dubbeld
Newbie
Newbie


Joined: 23 Jan 2005
Posts: 9

Reputation: 15.8Reputation: 15.8

PostPosted: Wed Mar 23, 2005 3:08 pm    Post subject: Reply with quote

Found it...

Code:
__PACKAGE__->can("$something")->();
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group