Gohaku wrote:
> 
> Hi everyone,

Hello,

> I was just curious if there is someway to add a variable when using qw.
> I am trying to do the following:
> #Testing qw....
> $string_variable = "abc";
> @array = qw( string_literal1 string_literal2 $string_variable )
> print join(" ",@array);
> #Would like to see:
> #string_literal1 string_literal2 abc
> 
> I realize I could do the following:
> @array = qw( string_literal1 string_literal2 );
> push(@array,$string_variable);
> 
> would like to hear if there is a shorter way...

Well, you could do it like this:

my @array = ( string_literal1 => string_literal2 => $string_variable );


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to