[tpm] Using a variable in a 'qw()'

Mark Fowle mfowle at navicominc.com
Thu Jun 12 07:29:03 PDT 2008

qw is just a way of saying quote the following words for me.
qw(adam john mary)
Is equivalent to ("adam","john","mary")

So use Net::DBus::Exporter ($foo);

Is a safe and reasonable alternative

If you need to mix variables and trings use:
use Net::DBus::Exporter ($foo,"bar","baz");


-----Original Message-----
From: toronto-pm-bounces+mfowle=navicominc.com at pm.org
[mailto:toronto-pm-bounces+mfowle=navicominc.com at pm.org] On Behalf Of
Madison Kelly
Sent: Thursday, June 12, 2008 10:25 AM
To: Toronto Perl Mongers
Subject: [tpm] Using a variable in a 'qw()'

Hi all,

   I want to use a variable when calling a module that uses the 'qw()' 
syntax. Specifically:

use Net::DBus::Exporter qw(org.tle_bu.Clients);

   I would like to be able to say:

my $foo="org.tle_bu.Clients";
use Net::DBus::Exporter qw($foo);

   But '$foo' is passed in directly, rather than it's value. Is there an

alternative to 'qw()'? Honestly, I use that syntax all the time but I've

never really understood how it works. Perhaps I should be asking for a 
pointer to a doc that explains this syntax better?

Thanks, as always!

toronto-pm mailing list
toronto-pm at pm.org

More information about the toronto-pm mailing list