Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: How to use a scalar variable to call a subroutine?

by kilinrax (Deacon)
on Feb 05, 2001 at 22:45 UTC ( #56468=note: print w/replies, xml ) Need Help??


in reply to How to use a scalar variable to call a subroutine?

In order to use a 'soft' reference such as this, you'll have to turn off strict refs:
#!/usr/bin/perl -w use strict; sub filename($){ print "it worked!\n"; } my $dbh; my $filename = 'filename'; no strict 'refs'; &{$filename}($dbh); use strict 'refs';

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2022-05-25 02:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (84 votes). Check out past polls.

    Notices?