in reply to qw() problem

Split, already mentioned, is the correct solution. It's possible to coerce qw// to work on a variable using stringy eval. Your unexpected behavior happens because qw , like q, does not interpolate variables before acting. You can fake it by including the 'qw' as part of a string in an interpolating quote,

my $all = "\nname1 name2\n name3"; my @arr = someFunc(@dd, eval "qw/$all/";
That's not a recommended way to do it, but it's good to know about. It's sometimes desirable to do that when the arguments of tr/// are not known in advance.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: qw() problem
by Vynce (Friar) on Oct 10, 2005 at 21:03 UTC
    it's worth noting that using qw"$foo" also doesn't work, as much as you might want it to.